arleyandrada / PushClient

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

GCM Message is not delivered when app is fully closed #111

Closed J0nAnder closed 8 years ago

J0nAnder commented 8 years ago

Hi Arley,

I was using your module and i found some kind of issue when the app is fully closed.

If the app is closed recently, the module works great, but in some hours the Module seems is not working and the GCM message is not correctly delivered.

Here you can see a fragment of logcat:

I/GCM     ( 1357): GCM message com.a3r.hirix 0:1450357838356749%9ffef7a5f9fd7ecd
W/GCM-DMM ( 1357): broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.a3r.hirix (has extras) }

In the manifest i don't have any references to the GCM.

¿Do you have an idea of what is going on?

Best regards.

arleyandrada commented 8 years ago

Hi JonAnder,

With an native Android app you can to write and register an BroadcastReceiver class to receive a push notification, even when the app is not running or was killed.

My module uses this class to deal with received push notification and, according to the message attributes, it shows the local notification with light, sound, etc... Unfortunately there is no way to communicate from this background thread with the Titanium Javascript code (registered event listeners) when the app is not running or was killed.

If you are sending "silent push notifications" it is a real problem.

Regards,

Arley

J0nAnder commented 8 years ago

Hi Arley,

I don't want to communicate with the broadcastReciever. I only need that the module show up the local notification.

When i close the app all works perfect, i send notification from my server and everything works.

But when the application is closed 1 or 2 hours, the notification is sended by the server, but the notification is not showed.

I only need that notification to comunicate the user some changes in the app.

Regards, Jon Ander

arleyandrada commented 8 years ago

Hi JonAnder,

Ok... with local notification everything should work.

Please, can you tell me which JSON payload are you sending from your server? Are you using another modules?

This messages / fragments from logcat is not from my module and I've never seen it before.

Some references from Google: https://groups.google.com/forum/#!msg/android-gcm/MqVlA3Sj26c/6O4TdU1pm0UJ http://stackoverflow.com/questions/8814817/c2dm-broadcast-receiver

Regards,

Arley

J0nAnder commented 8 years ago

Hi Arley,

I know the Logcat fragment is not from your module but is the Feedback than i can see on Logcat.

Here you have information i send from the server:

 {
  data: {
      data:{"title":"AppName",
            "alert":"New Notifications!",
            "notificationId":0,
            "vibrate":true,
            "sound":"default",
            "smallIcon":"iconnotification",
            "largeIcon":"appicon"
      }
  }
}

I use the next Titanium modules on my app:

Titanium SDK is: 5.1.1 GA

The error don't occurred every time. Sometimes, the app was closed some hours and the notification is not showed, today we have done some test and all the notifications were showed,

Looks like its something random with the GCM Message delivery to the application from the Google Play Services.

Regards, Jon Ander

arleyandrada commented 8 years ago

Hi J0nAnder,

Which device you're doing the tests and what the Android version used on the device? You did tests on different devices and different versions of Android?

Really seems to be a bug or a feature of Android.

It is a similar known issue in iOS, where the app is not notified when it is killed through the tasks window (only the alert / message is shown at notification bar).

Regards,

Arley

J0nAnder commented 8 years ago

Hi Arley,

The devices used to test the problem are these:

I will continue investigating this issue.

Thanks for all.

Best Regards, Jon Ander

arleyandrada commented 8 years ago

Hi J0nAnder,

I was unable to identify your email and also your PushClient license, only by your github username, to be able to send a new version of PushClient module to you.

I released a new version of my module, but the Appcelerator Marketplace is very lazy.

Regards,

Arley

arleyandrada commented 8 years ago

Related to : https://github.com/arleyandrada/PushClient/issues/57