通知显示在 android 模拟器中,但不在物理设备上

通知显示在 android 模拟器中,但不在物理设备上

问题描述:

我使用 JobScheduler 设置了 30 分钟的及时通知,我的应用程序在 30 分钟后在 Android Emulator(Pixel 3 API 29 Q-10)中显示通知,但不在我的物理设备(Samsung S8 Android 9 Pie)上显示.奇怪的是,当我在 30 分钟后打开应用程序时,会显示相同的通知.android 有什么限制吗?

I have set a timely notification of 30 minutes using JobScheduler, my app shows the notification in Android Emulator(Pixel 3 API 29 Q-10) after 30 minutes but not on my physical device(Samsung S8 Android 9 Pie). The weird thing is the same notification shows up when I open the app after 30 minutes. Are there any restrictions in android?

到目前为止我已经尝试过:

I have tried so far:

  • 使用 USB 调试器模式在物理设备上运行应用,没有错误.
  • 单独构建 APK 并将其安装在设备中

我发现,如果手机处于省电模式或任何电池优化模式,通知将不会显示.关闭省电模式对我有用.

I found that, If the phone is in power saver mode or any battery optimized mode the notifications won't show up. Turning off power saver mode worked for me.