In this page we'll dive deeper into several aspects of our Android library that can be customized to match your needs.
Instead of relying on the
notificare-services.json configuration file, it is possible to set those in code. If you are using the
re.notifica.gradle.notificare-services Gradle plugin, go ahead and remove it since it requires the configuration file to be present. To configure Notificare, you must run the following code before any other interactions with the library.
Notificare.configure( context = applicationContext, applicationKey = "", applicationSecret = "", )
Notificare.INSTANCE.configure(getApplicationContext(), "", "");
configure() method should be called before calling
Notificare.launch() to make sure the correct keys are used. After setting the keys programmatically you can safely delete the
By default, our library sends crash reports to our servers, which you can access via the Dashboard > Your App > Events > Application Error, in order to facilitate the debugging process for developers. If you would like to opt-out, you can do so by setting a metadata tab in your
<meta-data android:name="re.notifica.crash_reports_enabled" android:value="false" />
Some Huawei devices running HMS (Huawei Mobile Services) also have the Google Play Services. Our library will prioritise the latter. When you are supporting both types of device, and you want to explicitly prioritise HMS, you can set the
<meta-data android:name="re.notifica.preferred_mobile_services" android:value="Huawei" />
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.
<meta-data android:name="re.notifica.push.notification_lights_color" android:value="red" /> <meta-data android:name="re.notifica.push.notification_lights_on" android:value="1000" /> <meta-data android:name="re.notifica.push.notification_lights_off" android:value="2000" />
Notificare will use the application icon as the icon for notifications. You can change this behaviour by specifying the following in your
<meta-data android:name="re.notifica.push.notification_small_icon" android:resource="@drawable/ic_rocket_black_24dp" /> <meta-data android:name="re.notifica.push.notification_accent_color" android:resource="@color/notificare_blue" />
When the user interacts with a notification, we automatically remove it from the Notification Center. If you would like to disable this behaviour, you can set the auto-cancel property.
<meta-data android:name="re.notifica.push.notification_auto_cancel" android:value="false" />
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 to be done in your
res/values folders like shown below:
Labels used for Action Buttons in both the Notification Manager and 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 using the options in the
<meta-data android:name="re.notifica.action_label_prefix" android:value="custom_prefix" />