I've got the same piece of code in two apps.
In the test app, the portalItem is shown.
In the main app I'm working on, it is not. Other operational layers like WMS are in fact shown.
ArcGISMap map = new ArcGISMap(SpatialReferences.getWebMercator());
map.setBasemap(Basemap.createTopographicVector());
MapView mapView = view.findViewById(R.id.testmap);
mapView.setMap(map);
Portal portal = new Portal("https://www.arcgis.com");
PortalItem portalItem = new PortalItem(portal, "257f279bf6a5461e88db07f54aa85d71");
portalItem.loadAsync();
portalItem.addDoneLoadingListener(new Runnable() {
@Override
public void run() {
if (portalItem.getLoadStatus().equals(LoadStatus.FAILED_TO_LOAD)) {
portalItem.retryLoadAsync();
} else if (portalItem.getLoadStatus().equals(LoadStatus.LOADED)) {
FeatureLayer featureLayer = new FeatureLayer(portalItem);
Viewpoint viewpoint = new Viewpoint(36.7324863, -4.46812351, 500);
mapView.setViewpointAsync(viewpoint);
mapView.getMap().getOperationalLayers().add(featureLayer);
}
}
});
I'm a bit confused, as the code is the same, but the results are not. Any sort of guidance to find the root of the problem would be welcome. It is not the license, as I've tried with the same developer test license, with the same result, as well.
Thank you.
UPDATE EDIT:
It would seem that the license did make more of an effect than I thought. It is still weird. I have a separate map that I made, isolated, and with the development API KEY, it does work, as opposed with my LITE license. I do not understand, as I was under the impression that the LITE license would work with most of PortalItem's and FeatureLayer's methods.
Thing is, after I've loaded and drawn the PortalItem FeatureLayer, after I go to the app's "main map", it is drawn, but with really thick lines.
I do not know why I need to draw it into a different map, before getting drawn again. Further ideas and clarifications would be welcome.
Hi @SalvadorApltp .
The License string and the API Key are different things and independent of each other:
See these topics for more information (note, I am linking to the ArcGIS Maps SDK for Kotlin documentation since the ArcGIS Runtime SDK for Android is in extended support):
In this reply I focused on API Key because that seems to be what you're using, but note that API Key is just one way to access secure (private) content. You can learn more at the Security and authentication link above.
Thank you kindly for the clarification, @Nicholas-Furness I was indeed confused about the terminology and you have cleared things up.
I expected the Lite license we're using to be enough to load the PortalItem and have it be shown, but it is not the case.
Considering that the PortalItem, despite loading, is not drawn on the map, I presume that the PortalItem is in fact part of the Location Services, and therefore you need a proper API Key or an Oauth 2.0?
For some reason, I thought the Esri Living Atlas would be "public content", but you mention that it is private content?
Thank you kindly for your time in clarifying these matters, it is of immense help.
Hi.
Yeah, not all Living Atlas content is completely free. You can see from the details page of the item in question, that it's "Subscriber" content.
You can learn more about what that means here, but the short of it is that you'll need to authenticate to use it. It won't cost you any credits to access, but there are some items of content that for various reasons we cannot just open up publicly. You should be able to use a user-based or app-based OAuth token.