Portal addDoneLoading listener is not being called.

492
1
08-08-2017 06:41 AM
SalihYalcin
New Contributor III

Hi everyone, 

We develop an android app that uses Portal for named user licence. When I want to listen portal load event. addDoneLoading listener is not called. Here is my code. 

public class MainActivity extends AppCompatActivity {

    private MapView mMapView;
    private ProgressDialog pd;
    Portal portal;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    

        String theURL = "http://********.ibb.gov.tr";

        //request that the Named User logs in with their credentials
        portal = new Portal(theURL, true);
        portal.setCredential(Utils.getUserCredentialsPortal());
        portal.addDoneLoadingListener(new Runnable() {
            @Override
            public void run() {
                LoadStatus ls = portal.getLoadStatus();
                switch (ls) {
                    case LOADING:
                        Toast.makeText(MainActivity.this, "Load Status 5 !!!  " + portal.getLoadStatus().name(), Toast.LENGTH_SHORT).show();

                        break;
                    case LOADED:

                        LicenseInfo licenseInfo = portal.getPortalInfo().getLicenseInfo();
                        ArcGISRuntimeEnvironment.setLicense(licenseInfo);

                        break;

                    case NOT_LOADED:
                        portal.retryLoadAsync();
                        Toast.makeText(MainActivity.this, "Load Status 7!!!  " + portal.getLoadStatus().name(), Toast.LENGTH_SHORT).show();

                        pd.dismiss();
                        break;

                    case FAILED_TO_LOAD:
                        //portal.retryLoadAsync();
                        Toast.makeText(MainActivity.this, "Load Status 8 !!!  " + portal.getLoadStatus().name(), Toast.LENGTH_SHORT).show();

                        pd.dismiss();
                        break;
                }


            }
        });
        portal.loadAsync();
        mMapView = (MapView) findViewById(R.id.mapView);
        MapViewUtils.setUpBaseMap(mMapView, "https://************/arcgis/rest/services/RehberSB/MapServer", Utils.getUserCredentialsItfaiye());

    }

    @Override
    protected void onPause() {
        super.onPause();
        mMapView.pause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mMapView.resume();
    }
}

How could I afford to call addDoneListener ?

Thanks for helpings. 

0 Kudos
1 Reply
AlexanderNohe1
Occasional Contributor III

Have you tried running this against ArcGIS Online and seeing if it calls the doneLoadingListener?  Could it potentially be a portal configuration problem?

0 Kudos