I followed the example in the PushSharp repository at: PushSharp Android Client Sample
Everything is working great if the app is open or in the background (by hitting home or back button). If I close the app by swiping it away in the application manager I no longer receive notifications, though.
My assumption was that since the PushHandlerService is marked as a [Service] that it would remain open even when the app is closed and continue to listen for notifications. Is there a way to continue to receive notifications with the app closed, or am I just doing it wrong?
I would include code but what I've got is taken pretty much exactly from the example at the above link.
EDIT:
I tried firing PushClient.Register on app start even through the device is already registered in hopes that this would start the PushHandlerService if it wasn't started. Even with re-registering on each launch of the app I still don't receive notification when the app is closed.
Did you tried it with debug, or release mode? I experienced the same when I started my app in Debug mode.
So, turns out that some Android devices battery or protected Apps settings causes the notification not to display. For example, in Huawei EMUI devices going to "Protected apps" settings and turning on the protected switch enables the app to receive push notification even after the app is terminated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With