Android SDK
Start the SDK
Integration Guide
7 min
prerequisites the fortersdk requires initialization from your application's main context if you haven't set up an application class yet create an application class https //developer android com/reference/android/app/application htmlregister it in your androidmanifest xml http //stackoverflow\ com/questions/2929562/register application class in manifest integration steps 1\ initialize the sdk add the following initialization code to your application class's oncreate() method string deviceuid = forterintegrationutils getdeviceuid(this); // get fortersdk instance and initiate it with the application context ifortersdk ftr = fortersdk getinstance(); ftr init(this, appconstants forter site id, deviceuid ); you will need to provide a valid forter site id (please use the test site id only for debugging purposes) a unique device identifier specific to the current android device, preferably forterintegrationutils getdeviceuid advanced configuration of the sdk can be done by initializing the sdk with a customized fortersdkconfiguration please consult with your forter implementation engineer before changing the default configuration 2\ register callbacks after initializing the sdk in the oncreate() method of your application class, please register fortersdk callbacks the callback registration process differs based on your fortersdk version fortersdk 3 0 0 and above register for token updates using the built in token update listener the token received here will be required for the order api https //docs forter com/mobile sdks/fortermobileuid# 6zrk and should be the value of the fortermobileuid attribute fortersdk getinstance() registerfortertokenlistener(new fortertokenlistener() { @override public void onfortertokenupdate(@nonnull string fortertoken) { // this block is called whenever the forter token is updated // use `fortertoken` for the order api } }); fortersdk versions below 3 0 0 for older sdk versions, register the activity lifecycle callbacks after initialization if (build version sdk int >= build version codes ice cream sandwich) { 	registeractivitylifecyclecallbacks(ftr getactivitylifecyclecallbacks()); } complete integration example after performing the above steps, here's how your oncreate() method should look @override public void oncreate() { super oncreate(); string mobileid = forterintegrationutils getdeviceuid(this); // get forterclient instance and initiate it ifortersdk ftr = fortersdk getinstance(); ftr init(this, appconstants forter site id, // your unique forter site id mobileid // your device identifier ); // register for token updates (fortersdk >= 3 0 0) fortersdk getinstance() registerfortertokenlistener(new fortertokenlistener() { @override public void onfortertokenupdate(string fortermobileuid) { // forter token updated } }); // start generic activity based navigation tracking (fortersdk < 3 0 0) if (build version sdk int >= build version codes ice cream sandwich) { registeractivitylifecyclecallbacks(ftr getactivitylifecyclecallbacks()); } }