I am using Amazon AWS Mobile Hub in my app. I have configured the push notification feature. In the sample app provided by AWS the push notification registration is also successful. I can check the end point and subscription data in SNS portal.
But if I publish any message its not displaying in my App. Also in my Google Project the GCM data is nil.
While creating a project in Google API for GCM it provides a project name and an ID number.
I was submitting the name in Amazon AWS but it should be the ID number.
You mentioned GCM, so I'm assuming you're on Android. Are you using an AVD image in the Android Emulator or on an actual device?
How are you sending the push message? If you're using the Amazon SNS console, you can select the topic and push a message with Raw type and just put "Test" in the payload and it should show up.
One thing to check is that your device is not on a corporate or other VPN network which restricts any network access in its firewall rules. I know GCM push does not work consistently on our internal corporate LAN because of such firewall rules.
Related
Right now I'm trying to send mobile push notifications to my phone when someone publishes a message to SNS. I'm confused about what services I have to use. Do I have to use a 3rd party service like Firebase Cloud Messaging/GCM to send mobile push notifications? Or can I send it directly from SNS to my phone.
In AWS docs it's a bit contradicting to me.
https://docs.aws.amazon.com/sns/latest/dg/sns-mobile-application-as-subscriber.html
It says:
To begin using Amazon SNS mobile push notifications, you need
the following:
A set of credentials for connecting to one of the supported push
notification services: ADM, APNS, Baidu, FCM, MPNS, or WNS.
A mobile app that is registered and configured to use one of the
supported push notification services.
So that means we have to use a third party service right? But however in one of the AWS SNS tutorials:
https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html
it says we can create a platform endpoint for my mobile device so that it can recieve push notifications. I am extremely confused, do we have to use a third party service or can we send SNS push notifications directly to our phone?
I checked stackoverflow and the answers are not clear to me either
Can Amazon SNS push notifications directly to mobile devices?
Amazon SNS Sending direct push notification to individual device
Can someone please clarify this for me?
AWS SNS manages and abstracts different push notification services.
For AWS SNS to be able to make use of the appropriate push notification service, it would need a platform endpoint. It would need to know which platform (i.e iOS) an app is built.
it says we can create a platform endpoint for my mobile device
To create a platform endpoint, you would need a certificate coming from the Push Notification provider.
Example: .p12 is a certificate from Apple which will require "Push Notification" feature to be enabled.
Once a platform application is created, the app would need to register a unique device token to AWS SNS.
This device token is generated by iOS or Android to uniquely identify the device. The app can only generate the device token if it's properly signed by a certificate from the Push Notification provider.
do we have to use a third party service
Yes you need a third party service to:
generate the certificate with push notification feature enabled
generate the device token associated with your physical device
properly sign the app using the certificate
or can we send SNS push notifications directly to our phone?
AWS SNS manages this for you by matching device endpoints to the correct device token. Then invoking the appropriate push notification service. (i.e APNS, GCM).
Am setting up push notifications for my Android App. The App is not published into Google Play Store yet. Am testing this app by installing APK directly on my mobile.
Can FCM (Firebase Cloud Messaging Server) send notifications to mobile phones which has done installation from APK files directly (not through playstore)?
Just want to know how FCM will work in this case?
YES. FCM can send notifications to your app as long as your device is registered to receive messages with FCM server
On initial startup of your app, the FCM SDK generates a registration token for the client app instance. FCM Server will manage the registration token and use this token to identify your device and send notifications. Note that the registration token can be changed in some case View more here
You can test by sending notifications to your device from Notification Composer. Select target is Single Device and your registration token is target device.
// Get the current registration token
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
To handle message follow the document
Yes you can do by using Firebase console
In firebase console select Function tab which is present in left part of firebase console.
Download node.js in your system and code it according to your wish in node.js.
Firebase token should be mention in your java code.
I want to send push notification using firebase from my admin panel web page to the android phones registered in firebase database. I have tried sending notifications using PHP and mySQL but want to use firebase only to send notification. I have also tried sending notification from firebase console to android devices. But I want to use the firebase API to send notification from web to android devices.
Firebase Notification is a panel in the Firebase Console, where you can send messages to specific devices, device groups, topics and audiences. It cannot send messages to Web users (yet). There is no public API for Firebase Notifications.
There is an API for Firebase Cloud Messaging, on top of which Notifications is built. FCM support most ways of sending messages: specific devices, device groups and topics. It also supports sending to all platforms: iOS, Android and Web.
But sending messages to devices through FCM always requires that you specify the FCM Server Key. As its name implies, this key should only be used on trusted processes. The most common way to run a trusted process is to run it on your app server (for example using PHP code that runs on a hosted server). But you can also run it on your own machine. Firebase recently released Cloud Functions for Firebase, which allows you to run JavaScript functions on Google's hardware. Sending FCM messages is one of the documented use-cases for Cloud Functions for Firebase.
can someone explain about how push notification or message in android working? Does it operate within a VPN? How can the server send data to the device if it's not in the same network? Is it possible to make your own push notification/message? Please enlightened me :)
Push Notification in Android means, Google Cloud Messaging. First we need to enable google cloud messaging service from google developer console. Then need to create browser key to give from server side.
Now, when user need push, we have to register the device id to the google cloud server and it saved it permanently.
Now when server fires push at that time server request google cloud to send message to registered device id, and using that device id, google sends message to that particular device. So basically, whole things are depends on Device id.
I read about Google Cloud Messaging at http://developer.android.com/google/gcm/gcm.html.
It supports Third Party Application server to Android application push notification.
I am wondering whether it is possible to implement the same thing push/receive notification from an Android app on one mobile to the same Android app on another mobile using Google Cloud Messaging.
If not, is there any other free service available similar to Google Cloud Messaging?
An Android device can send a GCM message to another Android device. All it needs is the API Key (of the Google API Project ID that the app uses to register to GCM) an the Registration ID of the other device. Using these parameters it can send a GCM message to another device via an HTTP request.
Usually applications that use GCM require a 3rd party server in order to store the Registration IDs of all registered devices. If your app has a different way to let devices share their Registration IDs with each other without requiring a server, you don't need the server.
As far as I'm aware, there has to be a server in the middle to send the push notifications (Android -> Personal Server -> GCM Server -> Android)
So the Android device sending the notification would send some data to a script on the server (using a HTTP GET/POST), and that script would then send the push notifications to all the devices that you wanted it to
Following the example Code from google (GCM Client Example), you can build an app to get a registration ID for your device, but sending messages without a server wouldn't work in my opinion. I didn't tried by now, but what about using the Google Backend Starter, or (what I tried) using a Backend as a Service Provider like apiOmat if you can't afford or don't want to set up a server.