Skip to content Skip to sidebar Skip to footer

Android: Push Notifcation Toward An Specified Application Package

I'm trying to setup a server to send push notifications. I'm trying to send push notification toward user of an specified package e.g. something like com.mysite.android (This optio

Solution 1:

You cannot send push notifications to any external app except the apps you own, simply the user device token and your server key are linked under one project so you must use a server key and valid device tokens for "X" app

Solution 2:

This is manageable. However, for you to be able to send a Notification to an app, you first need to be a valid Sender.

By that, usually (if you are the app owner), all you have to do is Add the App to your Firebase Project, generate the google-services.json file and add it to your Android Project.

If you're not the app owner and you don't want to add the app via your Firebase Project, this can be overridden by simply modifying the google-services.json that is used in the app, adding your SenderID in it. But I highly doubt that you'd be given access to modify an app that isn't yours in the first place.

Note: It is not advisable to modify your google-services.json though.

If you were able to set your peoject as a valid sender, you will have to make use of Topic Messaging and subscribe the devices to a topic name that is their app package name.

Then when sending to the topic, simply use the name of the package in the to parameter like so:

"to":"/topics/<app_package_name_here>"

Post a Comment for "Android: Push Notifcation Toward An Specified Application Package"