-
Notifications
You must be signed in to change notification settings - Fork 514
GcmListenerService.onMessageReceived not called #63
Comments
Indeed, this seems to be the case. I've tested with a payload as follows:
The notification is displayed by the system, but the onMessageReceived(String from, Bundle data) method of the GcmListenerService implemention doesn't get called In AndroidManifest.xml MyGcmListenerService is defined as follows:
The server reference payload docs (https://developers.google.com/cloud-messaging/server#payload) says: The "the client app handles the data payload" part doesn't work. |
I think I found what's "the problem" From https://developers.google.com/cloud-messaging/server#notifications_and_data_messages So, the data is passed in the intent used to launch the activity, once the user clicks on the notification.
See the reference for notification payload at: https://developers.google.com/cloud-messaging/server-ref#notification-payload-support
I've tested this and can confirm that it works. (using XMPP connection) |
Thanks for Your explanation. But imo the implementation is kind of awkward. If the user dismisses the notification, the data will never be passed to application. Or am i missing something? |
Yes, that's the downside of letting the system handle the notification. |
So what if I want the iOS app to use the notification payload, and the android app to use the data payload for displaying the notification? Seems like I am SoL. Also, the notification icon is very limiting. On Lollipop, you cannot use a complex icon because it is automatically forced into a single color (makes the icon all white in my case. This doesn't seem right. |
I'm currently experiencing a consistent InternalServerError when trying to push a payload with the notification tag. I need this for my iOS app to display a banner notification when the app is in the background. |
+1 having similar issues as well. |
@void99 Why is this closed? This problem pretty much makes it impossible to route iOS and Android traffic together through GCM if you want any processing to occur. @joelSimpson and @StephenStrickland Make sure both body & title are set in the notification field. iOS doesn't use the title tag but it's required in order to send and may be the reason for this issue you're both having. EDIT: Unfortunately, I'm now seeing the InternalServerError again. The above suggestion doesn't fix the problem. |
Having the same problem as @ZakTaccardi trying to use Lollipop and support the same iOS notification body. This seems like it was overlooked. |
hi, i have problems with the Constants.KEY_MESSAGE_TXT variable, it doesnt import |
@pato89xd You have to define that constant yourself. The above code is just an example, you have to adapt it for your own needs. |
@mnemonicflow so there is no Constants class? |
@pato89xd You have to create it yourself. |
@mnemonicflow sorry about that i'm new on android, I'm implementing this, thanks |
Is this being fixed? This bug makes it impossible to use GCM to both iOS and Android users. |
We are having the exact same issue. It would suck to have to manage two different sets of GCM registration files to manage Android and iOS. Any news on the matter? |
The current implementation doesn't allow to send a message that is simultaneously a display notification for ios and a silent notification for android. I understand the issue and I appreciate your feedback. |
Hi I am new to android ,I have added custom additional data so that when the user clicks the notification, it opens the data I entered. However, it does not open. Anyone have a solution or an idea of the error I'm receiving? |
I have "an idea": show your source code. On Thu, Feb 18, 2016 at 10:45 AM, jackdevco [email protected]
|
Hi Thank you for the feedback. Please see code below. Appreciate the assistance. MainActivity.java package com.app.bradv_000.pushk; import android.content.BroadcastReceiver; import com.pushwoosh.BasePushMessageReceiver; import org.json.JSONArray; import java.util.ArrayList; public class MainActivity extends AppCompatActivity
Pushwoosh stats as well
doOnMessageReceive(intent.getExtras().getString(PushManager.PUSH_RECEIVE_EVENT)); doOnRegistered(intent.getExtras().getString(PushManager.REGISTER_EVENT)); doOnUnregistered(intent.getExtras().getString(PushManager.UNREGISTER_EVENT)); doOnRegisteredError(intent.getExtras().getString(PushManager.REGISTER_ERROR_EVENT)); doOnUnregisteredError(intent.getExtras().getString(PushManager.UNREGISTER_ERROR_EVENT));
ArrayAdapter(this, android.R.layout.simple_list_item_1, user);
PushWoosh data, will clear it
} UserNameAdapter.java (My custom Adapter) package com.app.bradv_000.pushk; import android.app.Activity; import org.json.JSONArray; /**
} activity_main.xml
username_list.xml
On Thu, Feb 18, 2016 at 1:46 PM, Alexander Farber [email protected]
|
In additional, when I have only |
@KirillMakarov the issue you mentioned is being investigated in #178 |
i'm only using the data payload in my android app , because i want the application to handle creating notifications , not GCM , problem is that when app. is in background the "onMessageReceived " method is never triggered , i don't want to use both notification and data payloads and pass data when the user clicks the notification to my activity this seems too awkward , appreciate any suggestions |
Can you post json which your app server post to gcm server for data notification? |
Yes
|
Maybe not a proper place to post (not a demo issue), but could not find answer elsewhere: when sending both "data" and "notification" keys as payload notification is displayed but onMessageReceived method is not called. The method is properly called when "notification" key is removed from payload. What could be the cause?
The text was updated successfully, but these errors were encountered: