User Tools

Site Tools


Developing Android application with ADUCID

ADUCID PEIG API provides simple way how to integrate ADUCID to custom client application. To keep session cookies, PEIG API uses http async client. (getAsyncClient())

Creating authentication request

1) First create an instance of PEIG API
(only one per application object / set of requests)

com.aducid.peig.api.Papi papi = new com.aducid.peig.api.Papi(android.content.Context ctx)
com.aducid.peig.lib2.PeigAPI peigApi = new com.aducid.peig.lib2.PeigAPI(android.content.Context ctx)

or create DummyApplication

public class DummyApplication extends com.aducid.peig.lib2.PeigAPILibApplication {
    protected com.aducid.peig.api.Papi papi;
    protected com.aducid.peig.lib2.PeigAPI peigApi;
    public DummyApplication() {
       peigApi = getPeigAPI();
       papi = getPapi();

2) Prepare a handler which is going to be called when PEIG API is finished (see below)

3) Call PEIG API method aducidAuthentication ():

peigApi.aducidAuthentication(java.lang.String url, android.os.Handler handler)

4) In your Handler override handleMessage (Message msg) and get the result:

com.aducid.peig.lib2.Result result = msg.getData().getParcelable("result");

then evaluate it - see Responses


Your code should evaluate these possible outcomes:


if result.isOK()

Your session is authenticated

In DemoBank, result.gerRedirect() contains link to page with account data. Method result.containsRedirectUri() returns true, if redirect contains some link.


else if (result.peigNotInstalled())

PEIG is not installed. To fix it, you can display a dialog and then open GooglePlay to install it:



else if (result.isNetworkError())

Communication error occurred – either phone has no connectivity or destination cannot be reached (wrong URL or server is not running).


else {other exception / redirect / state}

Custom application errors, authentication failed!

  • result.getException() contains ADUCID exception, there are possible states:
    • result.notAcceptedByUser(): user rejected
    • result.isFactorAbsent(): user doesn’t have personal factor (and server requires it)
  • result.getData() contains error message / reason
  • result.getRedirect() contains page that could be opened using browser / contains additional content to download/ display to the user.

See com.aducid.peig.lib2.Result class for all details

Retrieve data when authenticated

In case I. your result is “OK” and your mobile application is authenticated. Use this session to contact your application server. AsyncHttpClient is used as http client to keep session cookies and GET/POST/PUT/DELETE operations. Following example shows how to use this client to GET a page when authenticated:

peigApi.aducidContent(java.lang.String url, java.lang.String methodName, android.os.Handler handler)
  • url – target page / method URL, e.g.
  • methodName - method path, e.g. /accountRemote
  • handler – Android callback to be executed when data is loaded

Try to get data if not authenticated

To check your setup, test if you get error response from the server

Advanced requests

To accomplish a specific action like transaction use aducidFullOperationGet() or aducidFullOperationPost().

peigApi.aducidFullOperationPost(String url, String methodName, parameters, android.os.Handler handler)
  • url is address of your application including protocol, e.g.
  • methodName is path to required page / method (e.g. “/remotePayment”)
  • parameters are set of parameters which will be sent to the server, null if there is no parameter
  • handler – see above – your callback after ADUCID is done

Get the result:

Handler handler = new Handler() {
                    public void handleMessage(Message msg) {
                        if (msg.getData() != null) {
                            com.aducid.peig.lib2.Result result = msg.getData().getParcelable("result");
                            // do something with result

And parse it – see Responses

mobile-integration/android.txt · Last modified: 2019/08/01 10:03 by tjotov