This website is no longer maintained. Please, visit documentation.indigitall.com to read our updated documentation.
EN |
ESadvanced guide to configure the Android SDK
In this section you will find a series of more advanced functionalities that require a more complex development. We recommend that a developer be in charge of this configuration.
The indigitall SDK can manage the user's location. This allows you to use the location filters on the send push campaign screen ( Campaigns> Push> New push campaign > Filters> Geographical filters)
Once we have enabled this functionality, the end user will have to give their consent to the location permission and enable the location services of their smartphone, so that the application can obtain the exact location of the user.
Add localization permissions by including this line in the AndroidManifest.xml file:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
You can find the AndroidManifest.xml file in the following path:
There are two ways to manage location permissions:
Here we explain how to configure location permissions in automatic mode.
The AutoRequestPermissionLocation parameter must be added when the SDK is initialized. This is done using the following code excerpt:
//When you want to initialize indigitall
Configuration config = new Configuration
.Builder("<YOUR-APP-KEY>", "<YOUR-SENDER-ID>")
.setAutoRequestPermissionLocation(true)
.build();
Indigitall.init(context, config);
In Android there is a class where the status of the permissions is received after the user has changed them through the configuration. The following piece of code should be added to capture the status of the permissions:
//In the class you use to receive the results of asking for the permissions
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
Indigitall.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
}
The Activity by default is the initial screen of your app that is launched when a user clicks on a notification that does not have a deeplink. It is also the point where you should initialize the SDK. It is set by the DefaultActivity parameter:
//When you want to start indigitall
Configuration config = new Configuration
.Builder("<YOUR-APP-KEY>", "<YOUR-SENDER-ID>")
.setDefaultActivity("YOUR_ACTIVITY")
.build();
Indigitall.init(context, config);
You can associate your own ID to each device. In this way it will be easier and more intuitive for you to work with our tool. For example:
To make this association between your custom ID (externalId), and the identifier handled by indigitall (deviceId), you have to invoke the setExternalCode method:
//Remember to put your external code here
Indigitall.setExternalCode(this, "YOUR_EXTERNAL_ID", new DeviceCallback(context) {
@Override
public void onSuccess(Device device) {
//DO SOMETHING
}
@Override
public void onFail() {
//LOG ERROR
}
});
Do not worry about anything. Your IDs are irreversibly encrypted on the phone itself and sent securely to our servers. Not even the indigitall team can know this information.
If it is required to collect the user's WiFi information, in addition to the configuration of the Indigitall panel, you must add in the manifest the permissions that are exposed below, the service corresponding to the filter and add the parameter wifiFilterEnabled when it is initialize the SDK:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
// ANDROID 12 WIFI
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
//WiFi service
<service
android:name="com.indigitall.android.services.WifiStatusService"
android:permission="android.permission.BIND_JOB_SERVICE" >
</service>
<receiver android:name="com.indigitall.android.receivers.WifiWakeLockReceiver">
<intent-filter>
<action android:name="AlarmReceiver.Action.NETWORK_ALARM" />
</intent-filter>
</receiver>
//When you want to start indigitall
Configuration config = new Configuration
.Builder("<YOUR-APP-KEY>", "<YOUR-SENDER-ID>")
.wifiFilterEnabled(true)
.build();
Indigitall.init(context, config);
From android 8.0 to obtain the WiFi data, which are added to the manifest the location permissions. More information here: Android Developers
Please note that the WiFi scan time when the app is in the background or closed may be inaccurate.
If for some reason you don't want to show the push as the native android sample, we leave this option to show the push with our custom layout . To do this add the following code in the configuration before calling init:
//When you want to start indigitall
Configuration config = new Configuration
.Builder("<YOUR-APP-KEY>", "<YOUR-SENDER-ID>")
.setLayoutBasic(LayoutBasic.custom)
.build();
Indigitall.init(context, config);
if you are ENTERPRISE CUSTOMER you have to add this parameter in the configuration so that the SDK points to the correct environment:
Configuration config = new Configuration
.Builder("<YOUR-APP-KEY>", "<YOUR-SENDER-ID>")
.setUrlDeviceApi(YOUR_DEVICE_API_DOMAIN)
.setUrlInAppApi(YOUR_INAPP_API_DOMAIN)
.setUrlInboxApi(YOUR_INBOX_API_DOMAIN)
.build();
Indigitall.init(context, config);
Our SDK offers various callbacks that help you have greater control of the execution flow and implement custom behaviors.
To subscribe to these callbacks you have to:
Indigitall.init(context, config, new InitCallBack(context){
@Override
public void onIndigitallInitialized(Permission[] permissions, Device device) {}
@Override
public void onNewUserRegistered(Device device) {}
@Override
public void onErrorInitialized(String error) {}
});
The method onIndigitallInitialized of the InitCallBack object will execute when the SDK finishes initializing and the device is ready to receive notifications from indigitall.
Receive as parameter:
Here is an example that prints logs about the status of permissions and device information.
Indigitall.init(context,config, new InitCallBack(context){
@Override
public void onIndigitallInitialized(Permission[] permissions, Device device) {
super.onIndigitallInitialized(permissions, device);
Log.d("Push Permission: ", permissions[0].toString());
Log.d("Location Permission: ", permissions[1].toString());
Log.d("Device: ", device.toString());
}
});
The method onNewUserRegistered of the InitCallBack object will be executed when the device has been registered for the first time, that is, in the first execution of the app after being installed.
It receives as a parameter the Device object with the information associated with the device.
Indigitall.init(context, config, new InitCallBack(context){
@Override
public void onNewUserRegistered(Device device) {
super.onNewUserRegistered(device);
Log.d("Device: ", device.toString());
}
});
The onErrorInitialized method of the InitCallBack object will be executed only if an error occurs during the initialization of the SDK.
It receives the description of the error as a parameter.
Indigitall.init(context, config, new InitCallBack(context) {
@Override
public void onErrorInitialized(String error) {
super.onErrorInitialized(error);
Log.d("Error on Indigitall.init: ", error);
}
});
You can use the deviceGet method to get the information that the SDK has recorded regarding the device.
You must instantiate a DeviceCallback object and pass it as the second parameter of the deviceGet method. This callback will receive as a parameter the device object that contains all the information associated with the device.
Indigitall.deviceGet(context, new DeviceCallback() {
@Override
public void onSuccess(Device device) {
Log.d("Device: ", device.toString());
}
@Override
public void onFail() {}
});
You can choose to disable the device to block the receipt of notifications. It is a very useful method to:
To do this, you have the deviceEnable and deviceDisable methods.
You must instantiate a _Device Callback object and pass it as the second parameter. This callback will receive as a parameter the device object that contains all the information associated with the device.
Indigitall.deviceEnable(context, new DeviceCallback(context) {
@Override
public void onSuccess(Device device) {
Log.d("Device: ", device.toString());
}
@Override
public void onFail() {}
});
Indigitall.deviceDisable(context, new DeviceCallback(context) {
@Override
public void onSuccess(Device device) {
Log.d("Device: ", device.toString());
}
@Override
public void onFail() {}
});
Our SDK allows you to classify users into different customizable groups. This is very useful for:
Remember that you must first define the groups you want to work with in the indigitall console ( Tools> Interest groups </ a>). See our user manual for more info.
Use the topicsList method to get the list of groups that are configured in your indigitall project. The callback of this method receives as a parameter an array of Topics, which contains the information of all the available groups, as well as a flag that indicates whether the user is included in any of them.
Indigitall.topicsList(context, new TopicsCallback() {
@Override
public void onSuccess(Topic[] topics) {
//DO SOMETHING
}
@Override
public void onFail() {}
});
To manage the device subscription to one or more groups, there are two methods: topicsSubscribe and topicsUnsubscribe .
Optionally, both receive a TopicsCallback object as the third parameter, which will return the list of all Topic in the project.
//topics is typeof Topic[] or typeof string[]
Indigitall.topicsSubscribe(context, topics, new TopicsCallback() {
@Override
public void onSuccess(Topic[] topics) {}
@Override
public void onFail() {}
});
//topics is typeof Topic[] or typeof string[]
Indigitall.topicsUnsubscribe(context, topics, new TopicsCallback() {
@Override
public void onSuccess(Topic[] topics) {}
@Override
public void onFail() {}
});
Your app can send information to indigitall's servers to identify the actions and events that happen in it. This allows you to automate retargeting actions.
To register these events you have to call the sendCustomEvent method, passing a descriptive ID as a parameter (you can invent the one you like best) and set data you need.
Indigitall.sendCustomEvent(context, "YOUR_EVENT_ID", JSONObject("YOUR_CUSTOM_DATA"),object: EventCallback(context){
override fun onSuccess() {
// Do something in success function
}
override fun onError(error: Error) {
//SHOW ERROR
}
});
If you want to integrate the In-App messages in your application, you can do it with several complementary formats:
Below we tell you how to instantiate one or more In-App messages in banner format.
Remember that you should first have them defined in the indigitall console. See our user manual for more info.
Create a WebView view in your layouts. The size must match what you have defined in the indigitall console ( Tools> In-App / In-Web Schemas ). Remember to translate the units from PX to DP.
If it is configured in the console that the banner is hidden for X seconds, you have to add to the call the activity in which the inApp is located and add the callback didDismissed where it will indicate that the established time has elapsed, returning the web the inApp code so that you can, for example, hide it.
You can follow the example below:
<WebView
android:id="@+id/myBanner"
android:layout_width="230dp"
android:layout_height="33.33dp"
/>
Instantiate the In-App message using the showInApp method.
WebView view = findViewById(R.id.myBanner);
Indigitall.showInApp(getContext(), "myBanner_CODE", view, new ShowInAppCallback() {
@Override
public void onLoad(String inAppCode, WebView webView) {
Log.d("In-App loaded: ", inAppCode);
}
@Override
public void onSuccess(InApp inApp) {
Log.d("In-App: ", inApp);
}
@Override
public void onFail(String inAppCode, WebView webView, String message) {}
});
// If it is configured in the campaign so that the banner is hidden at X seconds:
Indigitall.showInApp(getContext(), "myBanner_CODE", view, new InAppCallback() {
@Override
public void onLoad(String inAppCode, WebView webView) {
Log.d("InApp loaded: ", inAppCode);
}
@Override
public void onSuccess(InApp inApp) {
Log.d("In-App: ", inApp);
}
@Override
public void onFail(String inAppCode, WebView webView, String error) {
}
@Override
public void didDismissed(String inAppCode, WebView webView) {
super.didDismissed(inAppCode, webView);
}
});
You can follow the example below:
<WebView
android:id="@+id/myBanner"
android:layout_width="230dp"
android:layout_height="33.33dp"
/>
<WebView
android:id="@+id/otherBanner"
android:layout_width="250dp"
android:layout_height="36dp"
/>
Instantiate In-App messages using the showInApp method.
ArrayList<WebView> views = new ArrayList<>();
views.add(findViewById(R.id.myBanner));
views.add(findViewById(R.id.otherBanner));
ArrayList<String> codes = new ArrayList<>();
codes.add("myBanner_CODE");
codes.add("otherBanner_CODE");
Indigitall.showMultipleInApp(getContext(), codes, views, new ShowInAppCallback() {
@Override
public void onLoad(String inAppCode, WebView webView) {
Log.d("In-App loaded: ", inAppCode);
}
@Override
public void onSuccess(InApp inApp) {
Log.d("In-App: ", inApp);
}
@Override
public void onFail(String inAppCode, WebView webView, String message) {
//show error if inApp is Expired, inApp was shown or clicked more than x times configured on indigitall console
}
});
// If it is configured in the campaign so that the banner is hidden at X seconds:
Indigitall.showMultipleInApp(getContext(), inAppCodeList, webViewList, new InAppCallback() {
@Override
public void onLoad(String inAppCode, WebView webView) {
Log.d("InApp loaded: ", inAppCode);
}
@Override
public void onSuccess(InApp inApp) {
Log.d("In-App: ", inApp);
}
@Override
public void onFail(String inAppCode, WebView webView, String error) {
//show error if inApp is Expired, inApp was shown or clicked more than x times configured on indigitall console
}
@Override
public void didDismissed(String inAppCode, WebView webView) {
super.didDismissed(inAppCode,webView);
Log.d("InApp didDismissed " + inAppCode);
}
});
Next we tell you how to instantiate an In-App message in popup format.
Remember that you should first have it defined in the indigitall console. See our user manual for more info.
Create a WebView view in your layouts. The size must match what you have defined in the indigitall console ( Tools> In-App / In-Web Schemas ). Remember to translate the units from PX to DP.
ConstraintLayout view = findViewById(R.id.myPopupParentLayout)
Indigitall.showPopUp(view, getContext(), "myPopup_CODE", new ShowInAppCallback() {
@Override
public void onLoad(String inAppCode, WebView webView) {
Log.d("In-App loaded: ", inAppCode);
}
@Override
public void onSuccess(InApp inApp) {
Log.d("In-App: ", inApp);
}
@Override
public void onFail(String inAppCode, WebView webView, String message) {}
@Override
public void didClicked() {
Log.d("popUp","didClicked")
}
@Override
public void didClosed() {
Log.d("popUp","didClosed")
}
@Override
public void didDismissed() {
Log.d("popUp","didDismissed")
}
@Override
public void onShowTimeFinished(
String inAppCode,
WebView webView,
int showTime
) {
Log.d("popUp", "onShowTimeFinished")
}
@Override
public void didDismissForever(InApp inApp, Error error) {
Log.d("Popup", "didDismissForever ")
}
});
If you want to customize the icon to close the Popup, you can do it with the following method to which you can pass a custom ImageButton , if you wanted to use our icon, just pass a null. The closeIconDisabled parameter is in case you don't want to show any icon, setting it to true to hide it or false to show it.
ConstraintLayout view = findViewById(R.id.myPopupParentLayout)
ImageButton myImageButton = ImageButton(context);
.
.//set ImageButton params
.
boolean closeIconDisabled = false
Indigitall.showPopUp(view, getContext(), "myPopup_CODE", myImageButton, closeIcon, new ShowInAppCallback() {
@Override
public void onLoad(String inAppCode, WebView webView) {
Log.d("In-App loaded: ", inAppCode);
}
@Override
public void onSuccess(InApp inApp) {
Log.d("In-App: ", inApp);
}
@Override
public void onFail(String inAppCode, WebView webView, String message) {}
@Override
public void didClicked() {
Log.d("popUp","didClicked")
}
@Override
public void didClosed() {
Log.d("popUp","didClosed")
}
@Override
public void didDismissed() {
Log.d("popUp","didDismissed")
}
@Override
public void didDismissForever(InApp inApp, Error error) {
Log.d("Popup", "didDismissForever ")
}
});
In the event that you want to show the InApp scheme in a different way to how our SDK paints it, we put at your disposal some methods so that you can customize the "painting", without affecting the statistics or the InApp functionalities.
InAppIndigitall.inAppGet(context, inAppId, new InAppCallback(context){
@Override
public void onFail(Error error) {
super.onFail(error);
}
@Override
public void onSuccess(InApp inApp) {
//DO SOMETHING
}
});
Thanks to the InApp functionalities (from version 4.18.0 ), it is possible to indicate that the inApp is displayed or pressed a maximum number of times, or if in the case of the popUp, after performing an action , such as pressing the close button, is not shown again. To do this we could do the following within the inAppGet method that we have seen previously:
InAppIndigitall.inAppGet(context, inAppId, new InAppCallback(context){
@Override
public void onFail(Error error) {
super.onFail(error);
}
@Override
public void onSuccess(InApp inApp) {
if (inApp.getProperties().getDismissForever() &&
PopUpUtils.INSTANCE.isInAppDismissForever(context, inApp)) {
//InApp was dismissed forever
} else {
InAppUtils.INSTANCE.inAppWasShown(context, inApp, new InAppWasShownCallback() {
@Override
public void didExpired() {
//InApp was expired
}
@Override
public void didShowMoreThanOnce() {
//InApp was shown more than" + inApp.getProperties().getNumberOfShows() +" times"
}
@Override
public void didClickOut() {
//InApp was clicked more than " + inApp.getProperties().getNumberOfClicks()+ " times"
}
@Override
public void onSuccess() {
//SHOW INAPP OR DO SOMETHING
}
});
}
}
});
For the case of what we call Dismiss Forever, once the action is performed, this method must be called:
PopUpUtils.INSTANCE.addNewInAppToDismissForever(context, inApp);
In the event that you want to show an inApp only if you make 'x' clicks or clicks on it, you must add the following:
Boolean result = InAppUtils.INSTANCE.inAppWasClicked(context, inApp, intent);
In this section you will find a series of more advanced functionalities that require a more complex development. We recommend that a developer be in charge of this configuration.
In order to get the notifications from Indigitall's Inbox, the user must identify himself. First you have to initialize the SDK of Indigitall so that it generates our identifier (deviceId) and be able to associate it with the custom ID that you associate to the device, similar to how is explained here .
To perform the registration tasks, these two methods are used:
//User ID
Indigitall.logIn(this, "YOUR_EXTERNAL_ID", new DeviceCallback(context) {
@Override
public void onSuccess(Device device) {
//DO SOMETHING
}
@Override
public void onFail() {
//LOG ERROR
}
});
//Disconnection
Indigitall.logOut(this, new DeviceCallback(context) {
@Override
public void onSuccess(Device device) {
//DO SOMETHING
}
@Override
public void onFail() {
//LOG ERROR
}
});
In this section you will see how to generate a validation token for an application that has configured authentication with webhook. To generate this token, you need to add the JSON with the configuration.
The token has a predetermined expiration date, once it has expired in our system, a listener event of type InboxAuthListener will be fired indicating said expiration and will have to return the configuration JSON. To collect the listener, you have to implement it in the corresponding class, and override the following method:
public class YOUR_CLASS implements InboxAuthListener{
.
.
.
@Override
public JSONObject getAuthConfig() {
return MY_JSON;
}
Once the device has been successfully registered, you can start making Inbox requests. The following characteristics of the Inbox must be taken into account, which are optionally configurable.
The notifications of the Inbox will have the following states of the class InboxStatus:
The notifications will also come with a 'read' status, to help differentiate those status.
Each notification will be assigned with an integer and unique sendingId, to be able to differentiate them and use them for some of the functionalities.
In the particular case of Android, when a new push from Indigitall arrives at the client device, an action defined in an intent is generated, which can be used to notify the user that they have a new message in the Inbox. To collect it, it must be implemented in the following way:
@Override
protected void onResume() {
super.onResume();
if (getIntent() != null && getIntent().getExtras() != null){
Bundle extras = getIntent().getExtras();
if( extras != null && extras.containsKey(Push.EXTRA_PUSH)) {
//DO SOMETHING
}
}
}
As explained above, to obtain the notifications the following method is used:
Inbox.Companion.getInbox(context, new InboxCallback(context) {
@Override
public void onSuccess(Inbox inbox) {
//DO SOMETHING
}
@Override
public void onError(Error error) {
//LOG ERROR
}
});
Once the Inbox instance is obtained, we will use it to request the next page, which is made with the following method, in the event that there are no more pages it will indicate it in the error with the code 410:
inbox.getNextPage(context,new InboxCallback() {
@Override
public void onSuccess(Inbox inbox, newNotifications: ArrayList<InboxNotification>?) {
//DO SOMETHING
}
@Override
public void onError(Error error) {
if (error.code == 410){
//LOG NO HAY MÁS PÁGINAS
}else{
//LOG ERROR
}
}
});
Take into account that the Inbox callback, apart from returning the updated Inbox, returns an array called newNotifications , in which the new notifications to be added to the Inbox will be displayed, so that, if necessary, be able to use said array to move between the pages without depending on the Inbox calls.
To get the information of a particular notification, you have to make the following call with the sendingId of each notification:
inbox.getInfoFromNotification(context, SENDING_ID , new InboxNotificationsCallback(context) {
@Override
public void onSuccess(InboxNotification inboxNotification) {
//DO SOMETHING
}
@Override
public void onError(Error error) {
//LOG ERROR
}
});
To edit the status of one or more notifications at the same time, it is done with the following method in which you must indicate the sendingIds of the notifications to edit and the status to which you want to change:
//Modify a notification
inbox.modifyStatusFromNotification(context,SENDING_ID,STATUS,new InboxNotificationsCallback(context) {
@Override
public void onSuccess(InboxNotification inboxNotification) {
//DO SOMETHING
}
@Override
public void onError(Error error) {
//LOG ERROR
}
});
//Massively modify
inbox.massiveEditNotifications(context,[SENDING_IDS],STATUS,new BaseCallback() {
@Override
public void onSuccess(JSONObject json) {
//DO SOMETHING
}
@Override
public void onError(Error error) {
//LOG ERROR
}
});
To find out the number of notifications in the Inbox according to their status, this method is performed:
Inbox.Companion.getMessagesCount(context, new InboxCountersCallback(context) {
@Override
public void onSuccess(InboxCounters inboxCounters) {
//DO SOMETHING
}
});
If you have custom Firebase classes, you may need to disable the following SDK services, defined in the manifest.xml.
<!-- <service
android:name="com.indigitall.android.services.FirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name="com.indigitall.android.services.FirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service> -->
If this is your case, you must add this code to ensure that notifications sent from indigitall are received and displayed.
In the service associated with the action _com.google.firebase.INSTANCE_IDEVENT add this line to register the push token.
@Override
public void onTokenRefresh() {
FirebaseUtils.setPushToken(context);
}
In the service associated with the _com.google.firebase.MESSAGINGEVENT action, if the notification comes from indigitall , the following lines of code will cause it to be painted.
//Google
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if(remoteMessage.getData() != null && !FirebaseUtils.pushNotificationIndigitall(remoteMessage, context)){
//Your Code
}
}
//Huawei
override fun onMessageReceived(newRemoteMessage: RemoteMessage?) {
if(remoteMessage.getData() != null && !HMSUtils.pushNotificationIndigitall(remoteMessage, context)){
//Your Code
}
}
In the event that you would like to obtain the push object of type json to carry out checks or actions that your application requires, we leave you this code that will help to obtain it:
@Override
protected void onResume() {
super.onResume();
if (getIntent() != null && getIntent().getExtras() != null){
Bundle extras = getIntent().getExtras();
if( extras != null && extras.containsKey(Push.EXTRA_PUSH)) {
Push push = new Push(extras.getString(Push.EXTRA_PUSH));
}
}
}
In the case of encrypted push, the Push object must be passed the context as an additional parameter:
@Override
protected void onResume() {
super.onResume();
if (getIntent() != null && getIntent().getExtras() != null){
Bundle extras = getIntent().getExtras();
if( extras != null && extras.containsKey(Push.EXTRA_PUSH)) {
Push push = new Push(context,extras.getString(Push.EXTRA_PUSH));
}
}
}
If you decide to treat the Push action independently without going through our SDK, the intent of the action is collected in your activity where the ServiceUtils.RegisterStatistics method should be called. For this case, you can, for example, create a class that extends from our PushNotification to generate the intent with the following extras:
public class MyPushNotification extends PushNotification {
Push push;
Context context;
public MyPushNotification(Push push) {
super(push);
this.push = push;
}
@Override
public void showNotification(Context context) {
this.context = context;
super.showNotification(context);
}
protected PendingIntent getIntent(PushAction action, int clickedButton) {
Intent intent = action.getIntent(context);
Intent indigitallIntent = new Intent(context, YOUR_ACTIVITY.class);
indigitallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
indigitallIntent.putExtra(StatisticService.EXTRA_APP_KEY, PreferenceUtils.getAppKey(context));
indigitallIntent.putExtra(StatisticService.EXTRA_PUSH_ID, push.getId());
indigitallIntent.putExtra(StatisticService.EXTRA_CLICKED_BUTTON, clickedButton);
indigitallIntent.putExtra(StatisticService.EXTRA_INTENT_ACTION, intent);
indigitallIntent.putExtra(Push.EXTRA_PUSH, push.toString());
if (action.getTopics() != null && action.getTopics().length>0){
indigitallIntent.putExtra(StatisticService.EXTRA_ACTION_TOPICS, action.topicsToString());
}
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
stackBuilder.addNextIntentWithParentStack(indigitallIntent);
return stackBuilder.getPendingIntent((push.getId()*10) + clickedButton, PendingIntent.FLAG_UPDATE_CURRENT);
}
}
Once the push has been collected as explained in the previous section, the following method must be called to register statistics:
ServiceUtils.registerStatistics(context,indigitallIntent);