arleyandrada / PushClient

FREE and Open Source - Titanium PushClient Module
Other
44 stars 17 forks source link

Not receiving notification when application not running in background (some phones) #120

Closed sulthankareem closed 8 years ago

sulthankareem commented 8 years ago

Hi sir, I have used your module. I feels some problem with this module. The application didn't deliver notification when application is not running in background, but no problem with some phones. My phone didnt receive notification, while application is not running in background. Working fine when application running in background

My Phone model: xiaomi redmi 2

arleyandrada commented 8 years ago

Hi,

Let's check somethings:

By default, the push notification is not shown in the notification tray when your app is in foreground. To iOS is a required behavior, to Android is a mimic from my module. But to Android, when receiving the push notification, you can call the showLocalNotification method and force to show a local notification in your notification tray.

PushClient.showLocalNotification(event.data);

When your app is in background, but is running / active, the notification is shown in notification tray without problems and your app continues to receive the callback.

When your app is not running, the notification is shown in notification tray without problems, but your app does not receive the callback until the user clicks on the received notification. But to iOS, if your push notification payload uses the "background notification feature" your app continues to receive the callback... and it is not possible to mimic this feature to Android.

When your app was killed by the user... different from not running or background... the iOS blocks all the push notifications messages, until the phone or the app is restarted. There is no problem like that with Android, that continues to work like "not running" described above.

Please, check the following related closed issues:

https://github.com/arleyandrada/PushClient/issues/111 https://github.com/arleyandrada/PushClient/issues/87 https://github.com/arleyandrada/PushClient/issues/1 https://github.com/arleyandrada/PushClient/issues/11

Regards,

Arley

arleyandrada commented 8 years ago

By the way... all described restrictions are required behaviors from iOS or Android or restriction imposed by the Titanium platform.

sulthankareem commented 8 years ago

I am discussing Android only. I already mentioned the mobile model, where I check the notification.Did your module have any problem like this? or is this the problem of my mobile model?

arleyandrada commented 8 years ago

So far, I don't know any problems with push notifications related to the device model.

Please, check and share with me the full log when your xiaomi device receives the push notification in foreground... and after receiving successful in background.

arleyandrada commented 8 years ago

Googling I found a "problem" with xiaomi devices when receiving push notifications in background, but OK to foreground.

Why can’t I receive push notification when I quit the Line app or WhatsApp? A: Normally, push notification is available only when the chatting apps are in use or running in the backend. If you sign out of the apps or clear the RAM of these apps, it will result in the unavailability of push notification. If you want to receive push notification, please lock these chatting apps when they clear up, and enable the app auto-start option. Go to "Security" >> "Permission" >> "Auto-start Management" >> add auto-start apps To enable push notification in the status bar, go to "Settings" >> "Notifications" >> "Manage Notifications" >> Open WhatsApp >> "Show in Status Bar" (switch on) Long-tap the Menu key to enter the recent apps backend. Drag down the app icon to lock it, so it will not be cleared in the following clear-up operation.

arleyandrada commented 8 years ago

Xiaomi for security purposes disables the Notification for each Application. Follow these steps to receive messages in background once they quit the app using cleaner.

Enable AutoStart

Enable Floating and Lock Screen Notification

For Reference check this out : http://support.hike.in/entries/55998480-I-m-not-getting-notification-on-my-Xiaomi-Phone-For-MIUI-6-