on 10-16-2015 4:29 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.