Skip to Content
avatar image
Former Member

Problem unlocking Store in LogonCore

Hi,

I'm trying to onboard users to SMP 3.0 using the OData SDK, following this example:

How To... On-board users with SMP 3.0 OData SDK (Android)

On the first run of the application (when there is no storeAvailable) everything works fine. A new secure store is created, then it is unlocked. I successfully register the new user on the SMP platform and receive back a connection id and store it in the vault.

logonCore.init(this, APPLICATION_NAME);

try {

     if (!logonCore.isStoreAvailable()) {

          logonCore.createStore(null, false);

     }

     logonCore.unlockStore(null);

     appConnId = logonCore.getObjectFromStore(VK_APPCID);

}

catch(LogonCoreException e) {

     Log.e(LOG_TAG, e.toString());

}

When I open the application for a second time and my code goes directly to unlockStore an exception is thrown:

Caused by: java.lang.NullPointerException

E/AndroidRuntime:     at java.lang.String.<init>(String.java:228)

E/AndroidRuntime:     at com.sap.maf.tools.logon.core.LogonCore.getAppSettings(LogonCore.java:1934)

E/AndroidRuntime:     at com.sap.maf.tools.logon.core.LogonCore.unlockStore(LogonCore.java:700)

E/AndroidRuntime:     at com.test.MainActivity.onCreate(MainActivity.java:87)


It crashes on the following line in the LogonCore.class:


String settingsFormat = new String(this.storeMan.getByteDataFromStore("VK_APP_SETTINGS_FORMAT"), "UTF-8");

I am using SAP Mobile SDK 3.0 SP10 PL01. What am I doing wrong?




Best regards,


Mihail



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 22, 2015 at 04:35 PM

    Hi Mihail,

    There's an error in my documentation. The application should only create the store when the registration is successful. Replace your code above for


    //Initialize LogonCore with application configuraton name
    lgCore.init(this, APPLICATION_NAME);

    //Check if application connection exists
    try {

       //check if secure store is available
       if (lgCore.isStoreAvailable()) {

       //Unlock the store
       lgCore.unlockStore(null);

       //Get application connection id
       appConnId = lgCore.getObjectFromStore(VK_APPCID);

      }

    } catch (LogonCoreException e) {

      Log.e(TAG, "error initializing logon core", e);

    }

    I'll rectify the guide soon,

    Sorry for the inconvenience,

    Claudia

    Add comment
    10|10000 characters needed characters exceeded