Regarding implementation of NotificationExtenderService in android (not answering the original question, but the question asked by @ryeballar), as explained in https://documentation.onesignal.com/docs/android-customizations#section-background-data-and-notification-overriding:
- I am getting notifications when the app is closed/swiped-out/not-started without implementing
NotificationExtenderService
However, in order to implement NotificationExtenderService you need to do the following (as described in the onesignal documentation referenced above, note that there is a typo there, fixed below):
- Create a file called
NotificationExtender.java in node_modules\react-native-onesignal\android\src\main\java\com\geektime\rnonesignalandroid, with the following contents:
.
import com.onesignal.OSNotificationPayload;
package com.geektime.rnonesignalandroid;
import com.onesignal.OSNotificationPayload;
import com.onesignal.OSNotificationPayload;
import com.onesignal.NotificationExtenderService;
import com.onesignal.OSNotificationReceivedResult;
public class NotificationExtender extends NotificationExtenderService {
@Override
protected boolean onNotificationProcessing(OSNotificationReceivedResult receivedResult) {
// Read properties from result.
// Return true to stop the notification from displaying.
return false;
}
}
- Add the following to
android\app\src\main\AndroidManifest.xml:
.
<service android:name=".NotificationExtender"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false">
<intent-filter>
<action android:name="com.onesignal.NotificationExtenderService" />
</intent-filter>
</service>
- rebuild your app