Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: No push notifications after reboot until I unlock the phone 1 time (AKA support for Android's directBootAware) #2035

Open
1 task done
uj opened this issue Mar 24, 2024 · 2 comments

Comments

@uj
Copy link

uj commented Mar 24, 2024

What happened?

Push notifications work after I install the app. They work if I force close the app.

However, if I reboot the phone, they do not work UNTIL after I unlock the phone 1 time. Then, they work fine. After that, I can lock the phone again and they still work. I can force close the app, lock the phone, and they still work.

However, if I reboot again, they do not work until I again unlock the phone 1 time after the reboot.

Every time I reboot, they stop working until after the first unlock and then everything is good from that point forward (until the next reboot).

Steps to reproduce?

Use Android 14
Create Flutter app with OneSignal Flutter SDK 3.5.2
Test that push notifications work.
Reboot phone, do not unlock.
Notice that push notifications do not work.
Unlock phone.
Push notifications work.

What did you expect to happen?

I expect push notifications to work after a reboot even if the phone has not yet been unlocked for the 1st time.

OneSignal Android SDK version

3.5.2

Android version

13

Specific Android models

NOT 13!  This is Android 14 (The bug report here with "Android Version" dropdown doesn't have 14 as a choice!  It goes up to 13 and forces you to choose - please fix that!).

Google Pixel 7

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jennantilla
Copy link
Contributor

@uj thanks for the report. That's interesting behavior. Android phones do tend to behave a bit unpredictably in a force-stop state which can vary between device manufacturer. We have some troubleshooting tips here. Can you let us know if any of those tips help?

I'll also update the dropdown to include Android 14. Just to confirm, have you tested on any other Android versions/noticed any differences in behavior (I wouldn't expect it, but just wanted to check!).

@uj
Copy link
Author

uj commented Mar 26, 2024

I assume it is because newer phones are encrypted, and by default, apps cannot run before the initial login after a boot because of that encryption. The initial login provides the decryption.

There is an android:directBootAware attribute that can be enabled, which will allow an app to use some special encrypted data area before decryption. I assume that OneSignal is not using that, and that is the issue here. As soon as I do the initial login, everything works properly.

Android runs in a secure, Direct Boot mode when the device has been powered on but the user hasn't unlocked the device. 
By default, apps don't run during Direct Boot mode. If your app needs to take action during Direct Boot mode, you can register app components to be run during this mode.

#https://developer.android.com/privacy-and-security/direct-boot

@jkasten2 jkasten2 changed the title [Bug]: No push notifications after reboot until I unlock the phone 1 time [Bug]: No push notifications after reboot until I unlock the phone 1 time (AKA support for Android's directBootAware) Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants