External Apps
You can choose several options to send your notifications:
* External Apps
External Apps on devices which you have installed or have not installed:
* Frequency of use
Sending a notification depending on the last time the user has visited your app/website.
* Devices type:
You can send your messages by devices type (mobile phone, tablet and desktop) and regarding used browsers (Safari, Opera, Edge, Firefox and Chrome).
Retargeting
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
}
});
Topics
Our SDK allows you to classify users into different customizable groups. This is very useful for:
- Implement a preferences screen so that the user can choose the topics for which they want to receive notifications.
- Label according to the navigation or actions that the user performs.
- Segment communications according to whether the user has identified or is anonymous.
- Segment based on language, culture, customer category, or based on any other criteria you need.
Remember that you must first define the groups you want to work with in the indigitall console (Tools> Topics).
- List groups
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() {}
});
- Manage subscription
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() {}
});
Set the default Activity
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);
Collection of push data
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));
}
}
}
Register statistics if the Push action is involved
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);