Hi A/all
I have an ArcGIS Online account and I'd like to access from a Java Application a content(Feature Layer) hosted with Organization scope.
I tried to write in Java the equivalent of this Python code(that works!):
user = 'my_user'
password = 'my_password'
dataitem = gis.content.get('f0d17c247_content_id')
In Java as:
UserCredential credential = new UserCredential("my_user", "my_password!");
final Portal portalOnline = new Portal("https://my_organization.maps.arcgis.com");
portalOnline.setCredential(credential);
portalOnline.addDoneLoadingListener(() -> {
if (portalOnline.getLoadStatus() == LoadStatus.LOADED) {
PortalUser user = portalOnline.getUser();
// Returns display name of authenticated user.
String userDisplayName = user.getFullName();
System.out.println(userDisplayName);
PortalItem portalItem = new PortalItem(portalOnline, "f0d17c247_content_id");
portalItem.getAccess();
portalItem.addDoneLoadingListener(() -> {
if (portalItem.getLoadStatus() == LoadStatus.LOADED) {
if (portalItem.getType() == PortalItem.Type.FEATURE_SERVICE) {
}
}
});
portalItem.loadAsync();
}
});
portalOnline.loadAsync();
The portalItem hangs in a LoadStatus.FAILED_TO_LOAD status!
What's my mistake? Which is the correct way to access via JAVA SDK a feature layer hosted in ArcGIS Online?