Executing Logon Operations
After you initialize the LogonUIFacade, present the MAF Logon UI screens. The LogonUIFacade interacts with MAFLogonCore components to execute logon operations.
In all of the following examples, the application must construct an activity, which
implements the LogonListener interface:
public class LogonActivity extends Activity implements LogonListener { //helper fields to keep the code cleaner private final String LOG_TAG = "LogonActivity"; private final String APPLICATIONID = "com.sap.maf.test.adr.logonapp"; private Context ctx; private LogonUIFacade logonUIFacade; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ctx = this; //get instance of LogonUIFacade Singleton logonUIFacade = LogonUIFacade.getInstance(); //reset MAFLogger MAFLogger.clearLogData(); MAFLogger.logToAndroid(true); //Initialize LogonUIFacade logonUIFacade.init(this, this, APPLICATIONID); //call the actual LogonUIFacade method that corresponds to //the Operation you would like to execute. ... } //LogonListener interface methods implemented! }
Logon
To present the logon screen from your
activity:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... //call Logon method of LogonUIFacade and set the resulting //view as content view of this Acvitity. setContentView(logonUIFacade.logon()); ... }
Delete Registration
You can present a button for the user to delete the registration. To trigger the delete user
operation, write a similar action callback method in your
Activity:
private void onDeleteUserButtonClicked() { ... logonUIFacade.deleteUser(); ... }
Lock Secure Store
To lock the secure store when the application is running and is in foreground, write a method
similar to this in your
Activity:
private void onLockButtonClicked() { ... logonUIFacade.lockSecureStore(); ... }This locks the secure store but does not present the logon screen. To present the logon screen after the secure store is locked, call the logon method of LogonUIFacade. This shows the unlock screen if the user has already been registered:
private void onLockButtonClicked() { ... logonUIFacade.lockSecureStore(); //call Logon method of LogonUIFacade and set the resulting //view as content view of this Acvitity. setContentView(logonUIFacade.logon()); ... }
Change App Passcode
You can provide a button to change the App Passcode. To trigger the change operation, write a
method similar to this in your
activity:
private void onChangeAppPasscodeButtonClicked() { ... this.ctx = this; ... logonUIFacade.changeSecureStorePassword(ctx, true); ... }
Update Back-End Password
You can provide a button to update the stored back-end password. To trigger the change
operation, write a method similar to this in your
activity:
private void onChangeBackendPassowordButtonClicked() { ... this.ctx = this; ... logonUIFacade.changeBackendPassword(ctx); ... }
Review Login Data
You can provide a dialog to review the registration information. Create a button on the UI and
write a method similar to this in your
activity:
private void onShowRegInfoButtonClicked() { ... this.ctx = this; ... logonUIFacade.getRegistrationInfo(ctx); ... }
Store Application Connection ID
You can store the application connection ID after logon with this
code:
String connId = LogonCore.getInstance().getLogonContext().getConnId();