cancel
Showing results for 
Search instead for 
Did you mean: 

Problem unlocking Store in LogonCore

Former Member
0 Kudos

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



Accepted Solutions (1)

Accepted Solutions (1)

claudiapacheco
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Former Member
0 Kudos

Hi Claudia,

We are also facing the same issue even after replacing the code provided above.


Could you please help us on this?

Regards,

Karthik

claudiapacheco
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Karthik,

I updated the guide https://scn.sap.com/docs/DOC-59555. could you please give it a try and let me know if the error persists?

Best regards,

claudia

Answers (0)