I have a simple app, that uses a AlarmManager and a BroadcastReceiver, nothing complicated, the onReceive() displays a toast. For those who dont have a Xiaomi, here is what the screen looks like:
If I swipe the app away, the Receiver method is not called at all, no Toast, no Logs. If I click on the (x) on the bottom side, which kills all the opened apps, everything works flawlessly. Toast displayed, Log written.
I have been trying to solve this problem for two days, with no success, so thats why I turn to You now, as I have no idea why is this happening.
I have overriden every on...() method in the main activity, to check the lifecycle of the app, it looks like this I click on the icon:
onApplyThemeResource
onCreate
onAttachFragment
onWindowAttributesChanged
onWindowAttributesChanged
onWindowAttributesChanged
onWindowAttributesChanged
onWindowAttributesChanged
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onWindowAttributesChanged
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onCreateView
onContentChanged
onStart
onPostCreate
onWindowAttributesChanged
onStateNotSaved
onResume
onResume
onResumeFragments
onEnterAnimationComplete
onAttachedToWindow
onCreatePanelView
onCreatePanelMenu
onCreateOptionsMenu
onPreparePanel
onPrepareOptionsMenu
onWindowFocusChanged
And if I kill it by (x) or swiping it away
onWindowFocusChanged
onUserInteraction
onUserLeaveHint
onPause
onCreateDescription
onSaveInstanceState
onTrimMemory
Any help will be greatly appriciated. I did not include the code, because I think the issue is with the phone. On emulator it works fine. Unfortunately I don't have another phone to try it.