Skip to content

Commit 4443667

Browse files
Nightsd01jkasten2
authored andcommitted
Fix Notification Restoration Crash for Android 7.0
• Fixes a crash (#263) by disabling notification restoration after app upgrades for Android 7.0 devices.
1 parent bc5b9a8 commit 4443667

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/UpgradeReceiver.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@
3030
import android.content.BroadcastReceiver;
3131
import android.content.Context;
3232
import android.content.Intent;
33+
import android.os.Build;
3334

3435
public class UpgradeReceiver extends BroadcastReceiver {
3536

3637
@Override
3738
public void onReceive(Context context, Intent intent) {
39+
40+
// Return early if using Android 7.0 or earlier due to upgrade restore crash (#263)
41+
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N)
42+
return;
43+
3844
NotificationRestorer.startDelayedRestoreTaskFromReceiver(context);
3945
}
4046
}

0 commit comments

Comments
 (0)