AnsweredAssumed Answered

Unable to use Token and Referer to query features table in android ArcGIS SDK

Question asked by manoj.y@epic on Nov 11, 2018

Below is the code I'm using for setting user credentials on ServiceFeatureTable.


credential = UserCredential.createFromToken(gisToken, referer);

ServiceFeatureTable featureTablePolygons = new ServiceFeatureTable(polygonUrl);



final ListenableFuture<FeatureQueryResult> queryResultPolygons = featureTablePolygons.queryFeaturesAsync(query);
queryResultPolygons.addDoneListener(() -> {
try {
FeatureCollection featureCollection = new FeatureCollection();
FeatureQueryResult result = queryResultPolygons.get();
FeatureCollectionTable featureCollectionTable = new FeatureCollectionTable(result);
FeatureCollectionLayer featureCollectionLayer = new FeatureCollectionLayer(featureCollection);

if (result.iterator().hasNext()) {
Feature feature = result.iterator().next();
Envelope envelope = feature.getGeometry().getExtent();
} else {
// Toast.makeText(mContext, "No polygons found for " + queryString, Toast.LENGTH_SHORT).show();
} catch (InterruptedException | ExecutionException e) {
Log.e(TAG, "Error in FeatureQueryResult: " + e.getMessage());



But this is not working. If I'm using AuthenticationManager then it's working fine but I don't want to use username and password in my code.