Example: Target Certain Android Manufacturers and Devices

Certain Android devices have a known issue where they do not get push notifications when the app is swiped away. More details on this here. This issue affects all push providers, but fortunately OneSignal provides a way to reach out to users of these devices to help educate them on how to enable push for your app if they swipe it away.

Using the Native Android SDK, you can easily check the deviceModel and deviceManufacturer. Then, based on this data, trigger the in-app message to ask those users to enable the proper settings on the device for your app.

Some example code looks like this:

//Gets the device model
String deviceModel = android.os.Build.MODEL;
//Gets the device manufacturer
String deviceManufacturer = android.os.Build.MANUFACTURER;
HashSet<String> manufWithIssues = new HashSet<>(Arrays.asList("samsung","huawei","xiaomi","oppo","vivo","lenovo","sony","asus"));
if (manufWithIssues.contains(deviceManufacturer.toLowerCase()){
  //Based on the device manufacturer you can trigger the IAM to show
  OneSignal.addTrigger("device_manuf", "issue_manuf");  //"issue_manuf" == deviceManufacturer
}

In this example, if the current device's manufacturer matches a manufacturer in the HashSet with known issues, it will be passed to the OneSignal addTrigger method which you can use to trigger the in-app message setup in your OneSignal Dashboard.

An example message might say:

Your device may not be getting our notifications! 😱
Please check your device settings have our important alerts turned on:

Settings ➝ Device Management ➝ Battery ➝ Unmonitored apps ➝ Add this app 👍

Settings ➝ Apps ➝ this app ➝ App Settings ➝ Notifications ➝ Set as Priority 👍

1922

Image showing in-app editor with preview of in-app warning user they may only be getting certain notifications