Notification on click doesn’t work when device is inactive for a long time


Note: notification is received in all cases and on click works in all cases when the device is active.

This issue is critical and occurs when the device is in standby mode for a long time or if the notification is received when the device is shutdown & you restart:

The notification when clicked doesn’t open the app, in fact, nothing happens.

react-native: 0.62.0
Device: Oneplus 3
Android version: 9

Steps to Reproduce Issue:

This issue usually won’t occur when the device is active. To reproduce you need to change the device settings & also make sure the app is killed.

  1. Settings > system > developer options > background process limit > no background processes
  2. Send a notification from the dashboard
  3. Notification is received on the device
  4. Click on the notification, the app doesn’t open

Anything else:
Note: I am using notification extender service to change the layout of the notification.

Also, I tried pending Intent with reference to this comment

Here’s the code:

import android.util.Log;
import com.onesignal.OSNotificationDisplayedResult;
import com.onesignal.NotificationExtenderService;
import com.onesignal.OSNotificationReceivedResult;
import java.math.BigInteger;
import android.widget.RemoteViews;
import android.content.Intent;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;

public class NotificationBigStyle extends NotificationExtenderService {
   String channelId = "";
   protected boolean onNotificationProcessing(OSNotificationReceivedResult receivedResult) {
      OverrideSettings overrideSettings = new OverrideSettings();
      RemoteViews notificationBig = new RemoteViews(getPackageName(), R.layout.notification_big);


   int requestID = (int) System.currentTimeMillis();

   Intent intent = new Intent(getApplicationContext(), MainActivity.class);
   PendingIntent pendingIntent = PendingIntent.getActivity(this,requestID,intent, PendingIntent.FLAG_UPDATE_CURRENT);

   try {
      JSONObject payload = new JSONObject(receivedResult.payload.rawPayload);
      String channelPayload = payload.getString("chnl");
      JSONObject channel = new JSONObject(channelPayload);
      channelId = channel.getString("id");
   catch (JSONException e) {

    overrideSettings.extender = new NotificationCompat.Extender() {
         public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {
                   return builder;

      OSNotificationDisplayedResult displayedResult = displayNotification(overrideSettings);
      return true;

1 possible answer(s) on “Notification on click doesn’t work when device is inactive for a long time

  1. Hey @jkasten2

    Thanks for your time. I checked with 4.0.4 and tried all the cases possible. For now, everything seems to be working!

    I will confirm in the next 3 days once it is tested thoroughly in Beta with our users.