Msisdn Data Listener
If the host application want to get the Msisdn and IMEI get with Applet. Can implement the next listener to get information from Server side.
Step 1 : Msisdn data listener
In the class that extend of Application class implement the listener MsisdnDataListener
like this :
public class MainApplication extends Application implements MsisdnDataListener {
@Override
public void onCreate() {
super.onCreate();
...
// SDK initizalization
...
SiprocalSDK.addMsisdnDataListener(this);
}
@Override
public void onTerminate() {
SiprocalSDK.removeMsisdnDataListener();
super.onTerminate();
}
@Override
public void onMsisdnDataListener(msisdnData: MsisdnData) {
//use the msisdn data received
}
}class MainApplication : Application(), MsisdnDataListener {
override fun onCreate() {
super.onCreate()
...
// SDK initizalization
...
SiprocalSDK.addMsisdnDataListener(this)
}
override fun onTerminate() {
SiprocalSDK.removeMsisdnDataListener()
super.onTerminate()
}
override fun onMsisdnDataListener(msisdnData: MsisdnData) {
//use the msisdn data received
}
}
In the previous code we do the next:
-
In onCreate() method with the line SiprocalSDK.addMsisdnDataListener(this) we subscribe to the listener for can receive the msisdn data.
-
In onTerminate() method with he line SiprocalSDK.removeMsisdnDataListener() we remove the listener before the app going to dead to avoid memory leak.
-
onMsisdnDataListener is the method with the app is going to receive the msisdn data in the param msisdnData.
MsisdnData this object contain the next properties:
- lastUpdate(Long) : Timestamp value send from server.
- msisdn(String): Last msisdn get by the Applet.
- imei(String): Last IMEI get by the applet.
Note: The SDK save in local storage the last msisdnData received from server, you can retrieve this value using the method SiprocalSDK.getLastSyncedMsisdnData().
Updated 1 day ago
