image


indigitall Android SDK


Contents

  1. Introduction
    1. Obtaining the SDK of Indigitall
    2. Obtaining the “App Token” for the application
    3. Obtaining the “Sender ID” and “Api Key” for the application
    4. Obtaining the google services json file for the application
  2. Integration
    1. SDK of Indigitall
      1. Import SDK from Gradle
      2. Import SDK from .aar file
    2. Configuration of Gradle
    3. Configuration of ProGuard
    4. Configuration of Android Manifest
  3. Using the library
    1. Starting the library
    2. Adjusting the library
    3. Synchronization with the device registration and get the deviceID
    4. Available functions of the library
    5. Library classes
    6. Push Messages
    7. Catch Push
    8. External Apps Service
    9. Sending Pushes with GIF
  4. Change Log
  5. Implementation Updates
    1. Update to 4.2 from older sdk versions
  6. F.A.Q
  7. Contact

1. Introduction

This document has all the information need to integrate the SDK of Indigitall in the application that is developed to work with an Android operating system. It shows all the steps necessary to integrate the SDK in an already existing application in order to use the indigitall platform. It is important to consult this manual before any development and to follow the entire steps indicated here to guarantee the correct functioning of the integration. The document is directed to Android developers, in which technical language is used and source code is used in the examples when necessary.

1.1 Obtaining the SDK of Indigitall

The SDK can be obtained configuring the gradle file (option that we recommended. This way is explained in the point 2.1.1.

There is another option to obtained the SDK clicking on the following link: SDK of indigitall for Android.

It is necessary to possess the identifier for the app, in which you wish to integrate the SDK, so that it can communicate with indigitall. To receive this identifier the developer must provide Indigitall the necessary date to be able to send notifications (Sender ID y Api Key) that can be obtained from the GCM tool (Google Cloud Messaging) or the Google FCM (Firebase Cloud Messaging).

1.2 Obtaining the “App Token” for the application

Each application that is registered in the Indigitall Control Panel will have a unique identifier called App Token. This identifier will be used to start the SDK and will be responsible of connecting the application with the indigitall platform, and in this way it will indicate to what application the notifications belong to on the device. The App Token is an application that can be obtained from the indigitall Control Panel by an administrative user in the “Detalles” section of the application.

1.3 Obtaining the “Sender ID” and “Api Key” for the application

Previously, so that an application could receive notifications from the GCM tool of Google, you needed some identifiers called Sender ID and Api Key. Now, with the new Google Tool called FCM this parameters are called “Sender ID” and “Server Key”, although we will continue to call them Sender ID and Api Key to facilitate the work done by users that already have the FCM. These identifiers will be used in the SDK to connect the GCM/FCM Google tool with the devices in which the application is installed. In the following link we explain how to get GCM and FCM identifiers. ObtainingSender IDand ApiKeyinGCM(GoogleCloudMessaging).

ObtainingSenderID andApiKeyinFCM

1.4 Obtaining the google services json file for the application

To download the app configuration file , you have to follow the next steps:

  1. Enter in the Firebase Console and open your project.
  2. Press in the settings icon and select "Configuration project".

    project_configuration

  3. Add your app to Firebase, From "General" tab press in the button that is shown in the next image:

    add_firebase

  4. Register the app in the Firebase. You have to set the app packet name and the SHA-1 sign (optional) and press in "Register App".

    register_app

  5. Download the google-services.json:

    download_json

Once you have the google-services.json, you must add the file in the root of your Android project that usually is the app folder.

2. Integration

2.1 SDK of Indigitall

The library of inditiall consists of a file with extension .aar that has been directly imported from the 'libs' directory for the project.

2.1.1 Import SDK from Gradle

build.gradle of the project ([project]/build.gradle):

    buildscript {
    ...
    dependencies {

        classpath 'com.google.gms:google-services:4.1.0'

        }
    }
    allprojects {
        repositories {
            mavenCentral()
        }
    }

build.gradle of the module ([project]/[app-module]/build.gradle):

    dependencies {
        ...

        implementation 'net.indigitall:pushsdk:4.2.+'

        ...
    }
    apply plugin: 'com.google.gms.google-services'

2.1.2 Import SDK from .aar file

build.gradle of the project ([project]/build.gradle):

    buildscript {
    ...
    dependencies {

        classpath 'com.google.gms:google-services:4.1.0'

        }
    }
    allprojects {
        repositories {
                flatDir {
                        dirs 'libs'
                }
        }
    }

build.gradle of the module ([project]/[app-module]/build.gradle):

    dependencies {
        ...

        implementation name: ‘indigitall’, ext: ‘aar’

        ...
    }
    apply plugin: 'com.google.gms.google-services'

2.2 Configuration of Gradle

To be able to use the library of indigitall you must configure the project so that compiled version (compileSDKVersion) will be 26 and add the following libraries:

  • Support library v4 of Android (unless your version is 26.1.0).
  • Google Play Services Library version 15.0.0 (minimum version for ‘fcm’ y ‘location’).
  • Okhttp of Square Library version 3.6.0 (to make calls to the indigitall server).

With this SDK version that supports Android Oreo (Android 8, api 26) is necessary:

  • The SDK Android compile version (compileSDKVersion) is configured to version 26.
  • The target app version (targetSdkVersion) is configured to version 26.

This configuration normally is established with the build.gradle file of the applications. The end result should look like the following example:

android {
        compileSDKVersion 26
        buildToolsVersion “27.0.3”

        defaultConfig {
                applicationId “net.indigitall.app”
                minSdkVersion 16
                targetSdkVersion 26
                versionCode 1
                versionName “1.0.0”
                ...
        }
        ...
}
...
repositories {
        flatDir {
                dirs 'libs'
        }
}
dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])

        implementation 'net.indigitall:pushsdk:4.2.+'

        implementation 'com.android.support:support-v4:26.1.0'
        implementation 'com.google.firebase:firebase-messaging:17.3.2'
        implementation 'com.google.android.gms:play-services-location:15.0.1'
        implementation 'com.squareup.okhttp3:okhttp:3.6.0'
        ...
}
apply plugin: 'com.google.gms.google-services'

2.3 Configuration of ProGuard

Applications that use ProGuard must include the following line in their ProGuard file to ensure the correct functioning of the library:

-dontwarn okio.**
-dontwarn com.squareup.**
-keep class com.squareup.** { *; }
-keep class net.indigitall.pushsdk.** { *; }

2.4 Configuration of Android Manifest

The next step is configure the AndroidManifest file of the application. Here the necessary permissions, services and receptors of the application will be established in order to receive notifications properly. To start you must add the necessary permissions for the correct execution of the application and the FCM library. The permissions that you need to add are the following:

<!-- Mandatory Permission -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/>
<uses-permission android:name="android.permission.BROADCAST_STICKY"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/>

<!-- Optional Permission -->
<!-- Location Permission -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Phone Permission -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE"/>

The location and telephone permissions are optional and are used to track the location of the user and to make calls in the case that these functions of indigitall will be used. It is necessary to declare a series of services inside of the application so that this can make correct use of the indigitall library.

For the correct register in FCM and receiving of the notifications the following services have to be declarated in the AndroidManifest:

<!--Service to receive notifications-->
<service android:name="net.indigitall.pushsdk.service.IndigitallMessagingService">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT"/>
    </intent-filter>
</service>
<!--Service to register the device in FCM-->
<service
    android:name="net.indigitall.pushsdk.service.IndigitallInstanceIDService">
    <intent-filter>
        <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
    </intent-filter>
</service>

The integrator has to add the next services for can use the functionalities of the SDK too:

Services to give support Android 8 (Oreo):

<!-- Services Android 8-->
<service android:name="net.indigitall.pushsdk.service.IndigitallJobService"
   android:permission="android.permission.BIND_JOB_SERVICE"/>
<service android:name="net.indigitall.pushsdk.service.LocationJobService"
   android:permission="android.permission.BIND_JOB_SERVICE"/>
<service android:name="net.indigitall.pushsdk.service.GifJobService"
        android:permission ="android.permission.BIND_JOB_SERVICE"/>
<!-- End services Android 8-->

Services to give support versions less than Android 8 (Oreo):

<!-- Start indigitall Services -->
<service android:name="net.indigitall.pushsdk.service.IndigitallService" />
<service android:name="net.indigitall.pushsdk.service.NotificationService" />
<service android:name="net.indigitall.pushsdk.service.LocationService" />
<service android:name="net.indigitall.pushsdk.service.GifService"/>
<!-- End indigitall Services -->

Also, as application components, you must declare a BroadcastReceiver called IndigitallBroadcastReceiver (this come with the indigital library).

<!-- Start indigitall Receiver -->
<receiver android:name="net.indigitall.pushsdk.broadcast.IndigitallBroadcastReceiver"
    android:enabled="true"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</receiver>
<!-- End indigitall Receivers -->

3. Using the library

To be able to use the library it is necessary to have the indigitall APP_TOKEN for the application and register it in the FCM service of Google to get the API_KEY and the SENDER_ID.

3.1 Starting the library

In the SDK the field APPLICATION_ID corresponds to the APP_TOKEN mentioned previously. The first step in the integration process is mandatory to carry out the register of the device in FCM correctly. The user has to create a configuration file (res/values/indigitall_values.xml) and set inside the value of the SENDER_ID:

<?xml version="1.0" encoding="utf-8"?>
<resources>
        <!-- Change value by own SENDER_ID -->
        <string name="indigitall_sender_id">999999999999</string>
</resources>

After this we have two ways to continue with the start of the library, indicating all the parameters in the object constructor of indigitall or declaring the rest of parameters in the indigitall_values.xml file with these predefined values. Let’s see both examples:

  1. Indicating all the parameters in the constructor:
final String SENDER_ID = "999999999999";
final String APPLICATION_ID = "99961644752e0e8e1e1f4d2.95374830";
final String MAIN_CLASS_NAME = “MainActivity”;
final String USE_EXTERNAL_APPS = “false”;
Indigitall indigitall = new Indigitall(MainActivity.this, SENDER_ID,
      APPLICATION_ID, MAIN_CLASS_NAME, USE_EXTERNAL_APPS);
  1. Indicating all rest of parameters in the configuration file (res/values/indigitall_values.xml):
<?xml version="1.0" encoding="utf-8"?>
<resources>
        <!-- Change value by own SENDER_ID -->
        <string name="indigitall_sender_id">999999999999</string>
        <!-- Change value by the APP_TOKEN provided by indigitall -->
        <string name="indigitall_application_id">99961644752e0e8e1e1f4d2.95374830</string>
        <!-- Change value by the own packet name -->
        <string name="indigitall_app_package_name">net.indigitall.app</string>
        <!-- Change value by the own Main Activity name -->
        <string name="indigitall_main_class_name">MainActivity</string>
        <!-- Change value by true if the user want to use this funcionality -->
        <string name="indigitall_use_external_apps">false</string>
</resources>

Now all you have to do is start the indigitall SDK in the constructor:

Indigitall indigitall = new Indigitall(ActivityMain.this); // Llamar si se usa el recurso xml
indigitall.initialize();

From both ways mentioned before, the library will obtain the application’s context, the sender_id and the application_id that will be provided after it is registered in our indigitall application.

The call to indigitall.initialize() is what starts the authentication process with the GCM/FCM service and the Indigitall platform, as well as starting the services that will a designated times, send the server position, post code, installed applications, etc.

3.2 Adjusting the library

Once we have completed the previous process, we have our own indigitall object, that allows us to change some of the adjustments of the library. We can indicate the icon of our application to see it on the notifications, the icon for the notification bar that appears on Android 5.0 or higher and the color that we want this last icon to have when notifications are sent. We can establish this parameter by doing the following:

indigitall.setIcon(R.drawable.your_icon_push);
indigitall.setSmallIcon(R.drawable.your_icon_5_0);
indigitall.setSmallIconColor(“#FF6600”);

Since Android 5.0 the notifications have 2 icons, a normal one (that usually is the icon of the application) and another monochromatic icon (that is White and transparent) that will be the one that shows on the notification bar and in the notification itself, being able to set a background color for this icon for Android 5.0 or the applications own icon for Android 7.0. You can visualize how it will look in Design specifications.

3.3 Synchronization with the device registration and get the deviceID

Indigitall provides a listener that it lets to know when the registration has been completed, to avoid possible conflicts with the device registration, like make actions with the deviceId (that is generated during the registration)

Indigitall indigitall = new Indigitall(ActivityMain.this);
  ...

  indigitall.setReadyListener(new ReadyListener() {
          @Override
          public void onReady(DataModel data) {
              // Get the deviceID for example.
              String deviceID = data.getDeviceID();
          }
      });
  ...

  indigitall.initialize();

3.4 Available functions of the library

Indigitall provides a series of methods so that the applications can make use of the library. These methods offer functionalities that go from being able to subscribe and manage Tags as far as operations to enable or disable the device.

The Tags have to be created previously to be able to list them on the panel, subscribe or unsubscribe to them.

The methods of the Indigitall class are the following:

/**
 * Check the state of the device to know if it receives or not receives notifications.
 * Implement #DeviceStatusListener.onChangeDeviceStatus(isDisabled);
 */
void checkDeviceStatus(Context context);

/**
 * Enable the device to let it receives notifications.
 * Implement #DeviceStatusListener.onChangeDeviceStatus(isDisabled);
 */
void enableDevice(Context context);

/**
 * Disable the device to avoid it receives notifications.
 * Implement #DeviceStatusListener.onChangeDeviceStatus(isDisabled);
 */
void disableDevice(Context context);

/**
 * Check if the location is enabled or disabled.
 */
boolean checkLocationStatus(Context context);

/**
 * Enable the location.
 */
void enableLocation(Context context);

/**
 * Disable the location.
 */
void disableLocation(Context context);

/**
 * Apply for the list of tags created in the panel.
 * Implement #TagsListener.onGetTagsList(tagsList);
 */
void tagsList(Context context);

/**
 * Apply for the list of tags to which the device is subscribed.
 * Implement #TagsListener.onGetTagsSubscriptions(tagsList);
 */
void tagsSubscriptions(Context context);

/**
 * Suscribe the device to list of tags.
 * Implement #TagsListener.onGetTagsSubscribe(wasSubscribed);
 */
void tagsSubscribe(Context context, ArrayList<TagModel> tags);

/**
 * Unsubscribe the device to list of tags.
 * Implement #TagsListener.onGetTagsUnsubscribe(wasUnsubscribed);
 */
void tagsUnsubscribe(Context context, ArrayList<TagModel> tags);

/**
 * Return the indigitall identifier of the device.
 */
String getDeviceID();

/**
 * Set the DeviceStatusListener in the Indigitall class.
 */
void setDeviceStatusListener(DeviceStatusListener listener);

/**
 * Set the TagsListener in the Indigitall class.
 */
void setTagsListener(TagsListener listener);
/**
 * Set the ReadyListener in the Indigitall class.
 */
void setReadyListener(ReadyListener readyListener);

The method getDeviceID can reset a zero value the first time that the library is opened if not enough time was given for it to generate.

3.5 Library classes

The indigitall library provides a series of classes to make interaction with this easier and to help the recollection and introduction of data.

This classes are divided into two groups (Objects and Listeners) and are as follows:

/**
 * Object that collects device data.
 */
net.indigitall.pushsdk.model.DataModel {
    //Collect the indigitall indentifier of the device.
    String getDeviceID();
    //Collect the indigitall library version.
    String getvLibrary();
    //Collect the version number of the Android SDK
    String getvAndroidSDK();
    // Collect the version code of Android.
    String getvAndroidCode();
    // Collect the vesion name of Android.
    String getvAndroidName();
    // Collect the name of manufacturer
    String getBrandName();
    // Collect the model name.
    String getModelName();
    // Collect the device code.
    String getDeviceCode();
    // Collect the name of phone company that has the phone permissions.
    String getCarrierName();
}

/**
 * Object that collects the data of sent pushes.
 */
net.indigitall.pushsdk.model.PushModel {
    // Used to collect the push of the Intent in the Main Activity.
        static final String PUSH_EXTRA;

    // Return the push identifier.
    int getId();
    // Return the push type.
    int getType();
    // Return the push subtype.
    int getSubtype();
    // Return the push title.
    String getTitle();
    // Return the push body.
    String getBody();
    // Return the icon URL of the push (if it was set).
    String getIconURL();
    // Return the image URL of the push (if it was set).
    String getImageURL();
    // Return the GIF URL of the push (if it was set).
    String getGifURL();
    // Return the push data send to app (if they were set).
    String getData();
    // Return the campaign description of the notification (if it was set).
    String getDescCampaign();

}

/**
 * Object that collects or sets the tags data to manage them.
 */
net.indigitall.pushsdk.model.TagModel {
    // Return the tag identifier.
    String getId();
    // Set the tag identifier.
    void setId(String id);
    // Return the tag name.
    String getName();
    // Set the tag name.
    void setName(String name)
    // Return the tag parent.
    String getParent();
    // Set the parent tag.
    void setParent(String parent);
    // Return if the device has been subscribed to tag.
    boolean isSubscribe();
    // Set if the device has been subscribed to tag.
    void setSubscribe(boolean subscribe);
}

/**
 * Listener that controls the device status to receive notification.
 * Type: interface.
 */
net.indigitall.pushsdk.listeners.DeviceStatusListener {
    // Method called when device status is received.
    void onChangeDeviceStatus(boolean isDisabled);
}

/**
 * Listener that controls the tag managements.
 * Type: interface.
 */
net.indigitall.pushsdk.listeners.TagsListener {
    //Method called when the tag list of application  is received.
    étodo llamado cuando se recibe el listado de tags de la aplicación.
    void onGetTagsList(ArrayList<TagModel> tagList);
    // Method called when the tags, that device is susbcribed,  are received.
    void onGetTagsSubscriptions(ArrayList<TagModel> tagList);
    // Method called when the device is subscribed to a tag or more than one tag.
    void onSubscribe(boolean wasSubscribed);
    // Method called when the device is unsuscribed to a tag or more than one tag.
    void onUnsubscribe(boolean wasUnsubscribed);
}

3.6 Push messages

Once we have completed the registration and starting process, the application is ready to receive push messages, the library will look after these messages and will show the appropriate notifications. The application will be able to collect data of the push messages when notifications of the “Open App” type are sent.

Thanks to Intent received by the principal Activity in the methods of onCreate and/or onResume as follows:

PushModel push = null;
Intent intent = getIntent();
if (intent != null) {
    if (intent.hasExtra(PushModel.PUSH_EXTRA)) {
        intent.setExtrasClassLoader(PushModel.class.getClassLoader());
        push = intent.getParcelableExtra(PushModel.PUSH_EXTRA);
    }
}

3.7 Catch Push

In case you want to capture all the push messages that arrive to the application, the indigitall SDK has a BroadcastReceiver that can be overwritten and will be raised every time a push arrives. The PushBroadcastReceiver will discriminate between indigitall push or other notification service providing a method to overwrite for each case.

You must overwrite and declare the new BroadcastReceiver as follows:

// En la nueva clase que llamaremos SampleBroadcast.java
public class SampleBroadcast extends PushBroadcastReceiver {
    @Override
    public void onIndigitallPushReceived(PushModel push) {
        Log.d("SampleBroadcast", "IndigitallPush");
    }

    @Override
    public void onOtherPushReceived(Bundle data) {
        Log.d("SampleBroadcast", "OtherPush");
    }
}
<!-- En el AndroidManifest.xml -->
<receiver android:name=".SampleBroadcast"
    android:enabled="true">
    <intent-filter>
        <action android:name="net.indigitall.action.PUSH_INDIGITALL"/>
        <action android:name="net.indigitall.action.PUSH_OTHER"/>
    </intent-filter>
</receiver>

3.8 External Apps Service

The External Apps service lets to send notifications depending on whether the user has or not has installed a specific applications. For that, the apps, that will be checked, must be defined in the panel.

For the service can be activated in Android:

  • Depending on the form to initialize the indigitall library:

    1. If the library was initialized passing the constants to the constructor, put the constant USE_EXTERNAL_APPS to true:
        ...
        private static final String USE_EXTERNAL_APPS = true;
        ...
        Indigitall indigitall = new Indigitall(MainActivity.this, SENDER_ID,
           APPLICATION_ID, MAIN_CLASS_NAME, USE_EXTERNAL_APPS);
    2. If the library was initialized using a .xml file, put the key indigitall_use_external_apps to true in the configuration file (res/values/indigitall_values.xml):

        <?xml version="1.0" encoding="utf-8"?>
        <resources>
            ...
            <string name=”indigitall_use_external_apps”>true</string>
            ...
        </resources>
  • Have the applications, that will be checked, defined in the panel.

3.9 Sending Pushes with GIF

For sending notifications with GIF, is neccesary define the next services in the AndroidManifest.xml file:

<!-- Start indigitall Services -->
...
<service android:name="net.indigitall.pushsdk.service.GifJobService"
        android:permission ="android.permission.BIND_JOB_SERVICE"/>
<service android:name="net.indigitall.pushsdk.service.GifService"/>
<!-- End indigitall Services -->

Once declaration of the service, it is actived and is working. For can send notifications of this sort, the user only has to follow the steps are indicated in the Panel User Manual: Panel User Manual

4. Change Log

Change Log v4.2

  • Update the location library to version 15.0.1
  • Update the messaging firebase library to version 17.3.2
  • Add the descCampaign field in the push model to send the campaign description.
  • Add classLoader of the PushModel to the intent that is received when the push is sent for read notification data.
  • Add safety measures to avoid the app crash when the push is read.

Change Log v4.1

  • Added the checking of the network status before enPoint call.
  • Added the alarm configuration when the device is in low_power mode.
  • Changed the GeoCoder to LocationManager.
  • Deleted the Picasso library to load the image.
  • Deleted the asyncTask to retry the register.
  • Created TimeUtils class and fixed the errors when print the Date objects.
  • Added security checking before show the notification with the notificationManager.
  • Deleted DataListener e IDL handlers for do not crash the Thread manager.
  • Created the DeviceDataUtils class for build the device data request.
  • Created the NightServiceUtils class for the methods that are used in the maintenance service during the night.
  • Deleted the AsycTask of the alarm for avoid possible crashes in the thread manager.

Change Log v4.0

  • Migrated from GCM to FCM for the notification shipping.
  • Added AsyncTask to obtain the address from Geocoder and so avoid ANR's problems.
  • Added AsyncTask to create the PendingIntent that launch the SDK's main service in versions lower than Android Oreo and so avoid ANR's problems.

Change Log v3.3

  • Check empty message in the GCM notification receiver service.
  • Armored the access with incorrect data in the time convert functions.
  • Armored the access to geocoder to obtain the address with incorrect latitude and longitude.
  • Locked the user action over the interactive notifications buttons when the device is locked.
  • Updated the Picasso library and optimized the process to attach the image in the notification.
  • Optimized the algorithm that determinate if the night services must be launched.
  • Added checking of appToken when the push notification is catched.
  • Changed the way to catch push for Android 8 versions.
  • Armored the access to internal SDK data.
  • Optimized the device register process when it is failed.
  • Refactor the services to support Android 8 (Oreo) in background.
  • Fixed the location starting when the location permissions are asked in no main Activity.
  • Location service started by indigitall Service to allow enable/disable the location when the app is closed.
  • Optimized the creation of DeviceData request.
  • Optimized the methods to schedule the Android 8 services.
  • Added manually the view identifiers in the SDK layouts instead of automatically.

Change Log v3.2

  • Added the possibility to disable/enable the location.
  • Added synchronism with the device registration.
  • Fixed the dependency between onReadyListener and dataListener.
  • Distributed the calls during the night service to balance the payload toward the server.
  • Created channels notification channels to support Android 8 (Oreo).
  • Adapted the services to give support Android 8 (Oreo).
  • Added the possibility to send GIF notifications.
  • Refactor the Logs that are shown in console.

Change Log v3.1

  • Fixed error in statistics.
  • Added algorithm to increase quadratically the time to send device info to the server in case of error.
  • Added the option to send a silent push.
  • Fixed error in the external apps feature.
  • Added the option to distribute through mavenCentral.
  • Optimized the process to track the location through alarm to reduce the battery consumption.
  • Notifications adapted to Android N.

5. Implementation Updates

5.1 Update to 4.2 from older sdk versions.

  • Update from 4.1 to 4.2 sdk version:
  1. Increase the verion of the SDK library to 4.2.+:

    dependencies {
        ...
    
        implementation 'net.indigitall:pushsdk:4.2.+'
        ....
    }
    
  2. Increase the version of the location and messaging firebase libraries in the build.gradle file of the app. The dependency would be like is shown following:

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
    
        implementation 'net.indigitall:pushsdk:4.2.+'
    
        implementation 'com.android.support:support-v4:26.1.0'
        implementation 'com.google.firebase:firebase-messaging:17.3.2'
        implementation 'com.google.android.gms:play-services-location:15.0.1'
        implementation 'com.squareup.okhttp3:okhttp:3.6.0'
        ...
    }
  3. Increase the google service classpath in the project build.gradle file ([project]/build.gradle):

    buildscript {
    ...
    dependencies {
    
        classpath 'com.google.gms:google-services:4.1.0'
    
        }
    }
    allprojects {
        repositories {
            mavenCentral()
        }
    }
  • Update from 4.0 to 4.1 sdk version:
  1. Increase the verion of the SDK library to 4.1.+:

    dependencies {
        ...
    
        implementation 'net.indigitall:pushsdk:4.1.+'
        ....
    }
    
  2. Delete the dependency of Picasso library in the build.gradle file of the app. The dependency would be like is shown following:

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
    
        implementation 'net.indigitall:pushsdk:4.1.+'
    
        implementation 'com.android.support:support-v4:26.1.0'
        implementation 'com.google.firebase:firebase-messaging:15.0.0'
        implementation 'com.google.android.gms:play-services-location:15.0.0'
        implementation 'com.squareup.okhttp3:okhttp:3.6.0'
        ...
    }
  • Update from 3.3 to 4.0 sdk version:

    1. Add the google-services.json as is indicated in the point 1.4 of the documentation: Obtaining the google services json file for the application

    2. Change build.gradle of the project:

      buildscript {
      ...
      dependencies {
      
        classpath 'com.google.gms:google-services:3.2.0'
      
        }
      }
    3. Chante build.gradle of the app, adding the plugin of the google-services and increasing the mayor of the SDK version, adding the firebase library and increase the version of location library:

      dependencies {
        ...
      
        implementation 'net.indigitall:pushsdk:4.0.+'
      
        implementation 'com.google.firebase:firebase-messaging:15.0.0'
        implementation 'com.google.android.gms:play-services-location:15.0.0'
        ...
      }
      apply plugin: 'com.google.gms.google-services'
    4. Delete several permissions, two services and a broadcastReceiver in the AndroidManifest.xml:

      <!-- Delete the next permissions-->
      <permission android:name="{yourpackage}.permission.C2D_MESSAGE"
          android:protectionLevel="signature" />
      <uses-permission android:name="{yourpackage}.permission.C2D_MESSAGE" />
      <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
      <uses-permission android:name="android.permission.WAKE_LOCK" />
      <!-- Delete the next services-->
      <service android:name="net.indigitall.pushsdk.service.GCMIntentJobService"
            android:permission ="android.permission.BIND_JOB_SERVICE"/>
      <service android:name="net.indigitall.pushsdk.GCMIntentService"/>
      <!--Delete the next broadcastReceiver-->
      <receiver android:name="net.indigitall.pushsdk.broadcast.GCMBroadcastReceiver"
          android:permission="com.google.android.c2dm.permission.SEND" >
          <intent-filter>
              <action android:name="com.google.android.c2dm.intent.RECEIVE" />
              <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
              <category android:name="{yourpackage}" />
          </intent-filter>
      </receiver>
    5. Add the services to register and receive the notifications in the AndroidManifest:

      <!--Service to receive notifications-->
        <service android:name="net.indigitall.pushsdk.service.IndigitallMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>
      <!--Service to register the device in FCM-->
        <service
            android:name="net.indigitall.pushsdk.service.IndigitallInstanceIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
            </intent-filter>
        </service>
    6. Save the SENDER_ID in a configuration file in res/values/indigitall_values.xml:

      <?xml version="1.0" encoding="utf-8"?>
      <resources>
              <!-- Change value by own SENDER_ID -->
              <string name="indigitall_sender_id">999999999999</string>
      </resources>
  • Update from 3.2 to 3.3 sdk version:

    1. Increase the medium value of the dependency in the gradle of the module:

              dependencies {
                  ...
                  implementation 'net.indigitall:pushsdk:3.3.+'
                  ...
              }
    2. Increase the version of the library support-v4, picasso, gcm and location:

         dependencies {
            ...
            implementation 'net.indigitall:pushsdk:3.3.+'
      
            implementation 'com.android.support:support-v4:26.1.0'
            implementation 'com.google.android.gms:play-services-gcm:10.2.1'
            implementation 'com.google.android.gms:play-services-location:10.2.1'
            implementation 'com.squareup.picasso:picasso:2.71828'
            ...
        }
  • Update from 3.1 to 3.2 sdk version:

    To realize the SDK update is necessary increase the medium value of the dependency in the gradle of the module:

    
          dependencies {
              ...
    
              implementation 'net.indigitall:pushsdk:3.2.+'
    
              ...
          }
  • Update from 3.0 to 3.1 sdk version:

    To realize the SDK update is necessary follow the steps indicated in the next link: Update from 3.0 to 3.1 sdk version

6. F.A.Q

  • Q: I receive no notifications. What can I do?
    A: Check the logs for the following message “RegisterService: Device registered”. If this message is received it is because the register of the notification has been completed correctly. If you still do not receive notifications, review your “App Token” and “Sender ID” and make sure that they are correct. Some devices such as Huawei and Xiaomi have battery savers that impair receiving the notifications correctly. If you have a device of this kind, configure it so to always receive notifications and after doing so, make tests with the application on top.

  • Q: What versions of Android does indigitiall provide support for?
    A: The library of indigitall compiles using minSdkVersion 16, so that the minimum version of Android that we can give support for is Jelly Bean (Android 4.1).

  • Q: I receive a small image. Is there any way to receive a larger image?
    A: The indigitall notifications can include two images, a small image that is square in the icon space and a larger panoramic image that appears below the body of the notification. The large images only appear in the types of notifications that are shown as photos. Check that, when receiving the message on the panel, the image will establish itself in the correct field and not as the notification icon.

  • Q: Why does a square icon appear on my device?
    A: Ever since Android 5.0 (Lollipop) the system uses a monochromatic icon to represent the application notifications on the status bar. If this icon has not been set manually, it will show by default the icon of the application, filling it with White and respecting only the transparencies of the icon. The indigitall library provides different methods to configuration the notification icons to suit your needs. See the section Adjusting the library.

  • Q: I do not receive the Geo-locations notifications. How can I fix this?
    A: Check if you have the geo-location of the device on and with all the permissions granted (if it is Android 6.0 or higher). Open the app and look for the corresponding logs of “LocationManager” and “indigitallService”, in these you can see how localization is changed and if this is significant or not. We refer to significant changes in localization if the device moves more than 100 m from the last known position. By defect this service will execute every 20 minutes, it is possible to modify this time frame in the indigitall panel.

  • Q: Is it required for me to ask for localization and phone permission to my users?
    A: Localization and phone permissions are optional; you can include them in the application’s manifest. In these cases some functionality that is related to permissions is lost, that could be Geo-localization or Geo-fencing notifications or the Click to Call kinds of notifications.

  • Q: My notifications are not on top. How can I make this happen?
    A: The indigitall notifications have the highest priority that Android allows; the only notifications that can appear on top are the ones that have the same priority. In these cases the notification that comes in last will be the one that will appear on top if both notifications have the same priority.

  • Q: How can I carry out development tests without affecting the production users?
    A: The “App Token” of an application in development and those of production are different one from another; this is so to avoid development notifications reaching production users. For this reason the development test can be carried out with no risk. Even so, you can always filter in the indigitall panel by created DeviceID and uploading a .csv file that contains the identifiers of the devices that you wish they receive notifications.

  • Q: How can I carry out production tests without affecting the users?
    A: The production tests are very sensitive, because if a mistake is made our notification can reach real users. For this reason we advise that when production tests are carried out to send out geo-locations or to filter them by DeviceID as was explained in the previous question.

7. Contact

We at indigitall are delighted to help you with any problem or question that may come up with the use of our solution. To contact use you can write us at soporte@indigitall.net. We will gladly get in contact with you as soon as possible.