Skip to Content
0
Former Member
Jul 23, 2015 at 03:07 AM

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

52 Views

Using the SMP OData 3.0 SDK to onboard users gives developers more control and freedom over the look and feel of the logon screen. The goal of this exercise is to show the key pieces of code and information needed to onboard users with the SMP 3.0 OData SDK using basic authentication.

This is my code.

package com.example.maflogon;

import com.sap.maf.tools.logon.core.LogonCore;

import com.sap.maf.tools.logon.core.LogonCore.UserCreationPolicy;

import com.sap.maf.tools.logon.core.LogonCoreContext;

import com.sap.maf.tools.logon.core.LogonCoreException;

import com.sap.maf.tools.logon.core.LogonCoreListener;

import com.sybase.persistence.DataVault.DVPasswordPolicy;

import android.os.Bundle;

import android.app.Activity;

import android.util.Log;

public class LogonActivity2 extends Activity implements LogonCoreListener {

private static final String TAG = "timothy";

private boolean isHttpsEnabled = false;

private String appConnId;

private LogonCore logonCore;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

this.initLogonCore();

registerDevice();

}

private void initLogonCore() {

logonCore = LogonCore.getInstance();

logonCore.init(this, "com.crv.mv");

logonCore.setLogonCoreListener(this);

}

private void registerDevice() {

Log.i(TAG, "appConnId:" + appConnId);

LogonCoreContext logonCoreContext = logonCore.getLogonContext();

logonCoreContext.setHost("10.0.97.52"); // please input the correct

// IP address here

int port = 8080;

logonCoreContext.setPort(port);

logonCoreContext.setHttps(isHttpsEnabled);

UserCreationPolicy ucPolicy = UserCreationPolicy.automatic;

logonCoreContext.setUserCreationPolicy(ucPolicy);

logonCoreContext.setSecurtityConfig("default");

logonCoreContext.setDomain("default");

// logonCoreContext.getConnId()

try {

logonCoreContext.setBackendUser("smpAdmin"); // please note: here we

// input SMP cockpit

// logon username,

// NOT backend

// username

logonCoreContext.setBackendPassword("s345in"); // please note:

// here we input

// SMP cockpit

// logon pwd,

// NOT backend

// pwd

} catch (LogonCoreException e) {

Log.e(TAG, "error entering user credentials", e);

}

logonCore.register(logonCoreContext);

Log.i(TAG, "after register");

}

@Override

public void applicationSettingsUpdated() {

}

@Override

public void backendPasswordChanged(boolean arg0) {

}

@Override

public void deregistrationFinished(boolean arg0) {

}

@Override

public void registrationFinished(boolean success, String message, int errorCode, DVPasswordPolicy arg3) {

Log.i(TAG, "registrationFinished, success? " + success); // If you get

// “success”

// in

// console

// output,

// go to

// cockpit/applictions/click

// on your

// application

// id, you

// will see

// if a new

// registration

// already

// created!

Log.i(TAG, "registrationFinished, message= " + message);

Log.i(TAG, "registrationFinished, errorCode= " + errorCode);

String Id = logonCore.getApplicationId();

try {

String AppConnectionID = logonCore.getObjectFromStore("appcid");

} catch (LogonCoreException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

@Override

public void traceUploaded() {

}

}

but exception is java.lang.NoClassDefFoundError: com.sybase.mo.MessagingClientException ,who can help me ?