Lockscreen Service Notification
Introduction
Buzzscreen uses Foregound Service and in principle, a foreground service results in ongoing notification. Since service notification must be shown when Foreground Service is running, we provide a support class to change notification content so that you can provide more contextually meaningful information for users.
cf) System Notification
On Android OS 8.0 and above, system notification is shown for all apps running in the background. By “running in the background”, it indicates the case when a user escaped from the app’s activity without terminating it, or the app is still running in the background even though the user terminated the app.
System notification is shown from the Android OS, so it is impossible to customize the contents. However, users can turn off the notification on their device - please refer to the blog article.
△ (Above: System Notification / Below: Service Notification)
Usage
Content | Method & Place | Detail | Example |
---|---|---|---|
Setting and Getting Lock Screen Service Notification Content |
You MUST use this class after calling | Below are components that you can set.
| public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
...
BuzzScreen.init("app_key", this, SimpleLockerActivity.class, R.drawable.image_on_fail, false);
// Notification Configuration
LockerServiceNotificationConfig config = BuzzScreen.getInstance().getLockerServiceNotificationConfig();
config.setTitle("Sample Title");
config.setText("Sample Text");
config.setSmallIconResourceId(R.drawable.ic_noti_small);
config.setLargeIconResourceId(R.drawable.ic_noti_large);
// config.setShowAlways(true);
}
}
|
How to Temporarily Replace Service Notification to Another Notification |
You must set
| If your app notifies users of some events using android notification, and at the same time the ongoing notification is also shown, then multiple notifications are shown in the bar. This could be harmful for user experience. Using the method below you can notify event notification on the place where your service notification is, and go back to the original one after user checks it.
|
|