indigitall SDK for push clicking here
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(@NonNull ErrorModel errorModel) {
//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(ErrorModel errorModel) {}
});
- 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(ErrorModel errorModel) {}
});
//topics is typeof Topic[] or typeof string[]
Indigitall.topicsUnsubscribe(context, topics, new TopicsCallback() {
@Override
public void onSuccess(Topic[] topics) {}
@Override
public void onFail(ErrorModel errorModel) {}
});
Firebase Utils
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
}
}
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 onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
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 onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
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);