i am completing android hive tutorial for GCM notification
but now i am unable to display the message in next activity
The response you are getting as of now if from the GCM server with the registration_id. This registration_id should be saved to your third party server which will identify your app running on various Android devices when a push notification has to be sent.
Your server sends data in key/value pairs. Your app receives that data as key/value pairs in the extras in the Intent. You know what your keys are, so just retrieve the values out of the extras that are tied to those keys
(e.g., getStringExtra("message"), getStringExtra("url")).
You will be getting the data from your server through GCM in form of a payload that you need to parse.
String json = intent.getExtras().getString("payload");
After you parse all the data (test, icons) you can display in your respective activity of the android app.
Related
Is it possible to encrypt the content of a notification received with the Firebase_Messaging Plugin for Flutter before displaying it?
We don't want to send decrypted notifications directly so the device should locally encrypt the message using a locally saved key.
Firebase Cloud Messaging supports two message types:
Notification messages, which are handled by the system if your app is not active, and are passed to your application code when it is active.
Data messages, which are always passed to your application code.
Since the system won't be able to display your encrypted messages, you'll need to use only data messages when doing end-to-end encryption. You'll then encrypt the message either at the sender or on the server, and decrypt it in the onMessage handler of the recipient before displaying the notification.
See for an example of this split (but without encryption) this example onMessage handler in the FlutterFire repo
I'm using Advanced REST API to send data message for push notification.
In firebase console i can select user segment
as "Version","language",Country" etc..But how to select user segment for
Data message sent from REST API?
Or is their any other way to use select User segment for data message?
Also i want to send the notification for the user who has not opened app for few days.Is it possible with firebase data message?
When using the FCM rest API to send message, you can't target Analytics user segments. You can only send to devices identified by their unique token, or to topics where the client app is subscribed. The only way to send a message to a user segment is through the Firebase console.
We are developing a Xamarin UWP app that is supposed to receive Push Notifications using WNS. We are using Amazon SNS to send notifications. We made sure that the app is registering itself with proper channel URI to our backend, package name of the app is same as in the store and using Cognito credential put device token entry in Amazon application arn. I have sent raw message to device endpoint and message received in device properly. We couldn't send as Json format and tried as mentioned in below link.
https://anbu2016.wordpress.com/2016/03/17/push-notification-with-wns-and-aws-sns/
But didn't know where to receive notification from application.
For example, ReceivedRemoteNotification as override method present in iOS and it will help process the notification. In my process sent argument then based an argument, we can navigate to different page. How can we do this in UWP using JSON format.
Please help me on this.
Regards,
Cheran
I'm sending data-only-payloaded message to fcm.googleapis.com/fcm/send and receiving it's ID:
{"message_id":6399566057759755347}
After that I can't find this message in my firebase console notifications list but I need to get data about number of receivers and openers of notification and display it on my service (need to get data about conversion by API). Is there the way to implement it? If no - is logging of delivering and opening of notificaions on my own server is a good idea?
I'm developing an app using Firebase, in the app there are groups and for groups there are multiple members. I want to send notifications to members in a particular group based on one of the users activity. As an example in a chat app, notification to others informing there is a new message.
I referred this blog post. As it seems best way to do this is Firebase Topic Messaging, all members can be subscribed to the group id as a topic.
My matter is how to avoid receiving notification to the member who's action causes to the notification.
I tried Firebase message sending to multiple topics but it only allows for two logical operations (&&, ||)
Firebase Cloud Messaging has two types of messages: notification messages and data messages.
The default behavior of Firebase is that notification messages will automatically be displayed if the app is in the background or not running. This behavior cannot be modified. If the app is in the foreground, the notification message will not be automatically shown, it will instead be delivered to your app's code.
Data messages on the other hand will always be delivered to your app's code.
Since the user sending the message will typically have the app open, the default behavior will automatically ensure the notification is not shown on the sending user's device.
But in the blog post you refer to there is a race condition for this. If the user closes the app between the time they send the notification to the server and the time the server sends out the notification, the notification may show on their device too.
If this is a concern for your app, you should not use a notification message. Use a data message instead and include enough information in the message to detect which user has sent it (e.g. the user's uid).