SDK

Customizations

In this page we'll dive deeper into several aspects of our Android library that can be customized to match your needs.

Notification LED Settings

You can send along the preferred color and blinking time of the notification light (only works on selected device models) per notification from the Notificare REST API or the Dashboard. However, you can also set a default color for your app. If neither are set, it defaults to white colored blinking for 500 ms on and 1500 ms off.

Notificare.shared().setDefaultLightsColor("red");
Notificare.shared().setDefaultLightsOn(1000);
Notificare.shared().setDefaultLightsOff(2000);

Notifications UI

Changing user interface in the Android is intrinsically decided by your app's styles. Basically Notificare will just use the styles you provide in your app, for the several elements used throughout our UI. We recommend these changes are done in your /res/values folders like shown below:

android styles

Action Labels

Labels used for Action Buttons in both the Notification Manager as well as Notification Dialogs can be localized by adding them as strings resources, where the name is equal to the label. To protect collision of resource names, they can be prefixed with a string. The prefix must then be set by calling Notificare.shared().setLocalizedActionLabelPrefix().

ProGuard

If you use ProGuard, rules for classes to keep are included with the AAR, so there is no need to manually add any rules for Notificare.

65k method limit exceeded

Notificare Android library is tested to work with MultiDex, both natively (Android 5 and above) as well as with the MultiDex support library.

Add the following to your app's build.gradle

defaultConfig {
  multiDexEnabled true
}

dependencies {
  compile 'com.android.support:multidex:1.0.1'
}

Then, override the attachBaseContext method in the Application class for your app.

@Override
protected void attachBaseContext(Context base) {
  super.attachBaseContext(base);
  MultiDex.install(this);
}

For more information on MultiDex and possible issues and workarounds, see Android Developer Documentation

Using this plugin in Ionic

Cordova plugins can also be used in other frameworks like Ionic. To use this plugin in Ionic start by installing it in your Ionic project using the following command:

ionic cordova plugin add cordova-plugin-notificare-push

Then you need to add the following line right after the import statements in your very first component, usually app.component.ts:

declare var cordova: any;

Then you can access our plugin by creating a constant like this one:

const Notificare = cordova.plugins.Notificare;

Once that is done is can follow our implementation guides as you would for Cordova.