Firebase data message to specific android app versions - android

i have an android app and i want to send a firebase data message to inform the users of a new app version available in the play store. I am sending a data message in order to reach devices in which the app is in background.
I want send the message to specific versions, or if it's possible to all versions except the last version.
What is the best way to do it? Can I specify a version number in a fcm data message?
Below is the data message i am sending.
Thanks in advance.
{
"to": "/topics/all",
"data": {
"title": "new version",
"body": "a new version is available in play store"
}
}

I don't have answer for your question but I can suggest another way to achieve your case.
Take a look at Firebase Remote Config.
You can define variable for your client to get anytime it start.
So for your case, we have 3 variable:
destinationVersion for your specific version
title
message
In the app, just put the logic like if app's version equal to destinationVersion , create a notification with title and message to tell user update the app
. Hope it helpful to you.

You can force users to update with Google now: https://developer.android.com/guide/playcore/in-app-updates#immediate

Related

How can I use FCM to send links to an android app

Upon clicking the notification, I want it to open the link in a separate browser. It doesn't matter if it launches the app or not. The final thing should be opening in a browser.
A detailed guide of code and procedures would be really helpful.
Any alternative idea would also be helpful.
AskFirebase
You cannot pass links or text directly from firebase console when app is in background . You need to use Advanced Rest Client which is available in Chrome extensions.
Here is an example what code you need to write in Advanced Rest Client
{ "data": {
"message": "Yee",
"image" : "url.jpg",
"sound": "default",
"linkk": "https://stackoverflow.com/questions/57335468/how-can-i-use-fcm-to-send-links-to-an-android-app"
},
"to" : "/topics/test"
}
In this example those who subscribed to topic test will receive this message and will be able to open link in your app.
But!!!!
You should try when your app is in foreground the link will work fine even when you send notification from firebase console.

Android : Unread message update in icon

I'm developing an android application with communication integrated. My application have to show number of unread messages via app icon, it's will be look like that skype, facebook or etc. I can not found any solutions to perform it, please help me.
You can use this library
It works well for most of the devices.
PS. Nexus devices (or, more specific, the google launcher) does not support this!
You have to pass token with a message if a message is read or not.
Suppose we have a token 0 for read messages and 1 for unread messages.
If message read then make token 0 else it is 1.
To count the total number of unread messages, count the total number of unread messages (where token=1) from the list.
You can use this repo or use any repo from this link

iOS Firebase Cloud Messaging Conflicting With Android

I am writing a iOS and Android application that is supposed to notify users through the FCM API yet there seems to be a catch-22 within the firebase API that involves both platforms:
On Android, to handle new notifications using a custom implementation of FirebaseMessagingService.onMessageReceived(), one must create a DATA only message server-side. E.g: { "data": {"param": "foo" },"to" : "/topics/bar"}. The moment a "notification" field is included in the json, the custom implementation will not be called when the app is in the background. This would be ok but...
On iOS, if the "notification" field is not included in the message, the message just isn't received when the app is in the background which is unacceptable.
Thus, to receive background notification on iOS, you need to add the "notification" field, but adding this field makes the Android apps display bogus, non-customizable notifications when in the background!
I hope there is something that I am missing in the documentation. I would like to know how others have overcome this problem and whether it would be wise to stick with FCM for iOS or ditch it for something else.

Disable iOS and Android App from App store and google play store with custom message to users

Is there a way to disable iOS and Android apps which are live, for a few hours and add some custom message to all users, Can this be done through itunesconnect for Apple or google developer console for andorid.
Note :- i dont want to release new Apps / change existing code.
max
I know you mentioned you don't want to release new apps or change existing code, but unfortunately for this level of customization you'll have to (to start!) There's no push of a button to do this for you for either dashboard.
There's multiple ways of doing this and there's no official documentation out there, so if this answer gets accepted by the OP still look around at other answers on this thread.
My approach is to listen to an endpoint that you create, may it be from dropbox, s3, parse, etc. that have certain key-value pairs that your application can retrieve and handle appropriately. To the level of customization is up to you.
Let's do the example of your "we're temporarily unavailable" idea. Have the endpoint do the following:
{
"unavailable" : false,
"unavailable_text" : "Sorry we'll be back shortly!"
}
Now on app start up you listen to this endpoint. One day the unavailable key will be true, when that happens in the success handler for the endpoint you'll put in some logic to present a UnavailableViewController of sorts that might have a UILabel called descriptionLabel
if ([json valueForKey:#"unavailable"]) {
UnavailableViewController* controller = [[UnavailableViewController alloc] init];
controller.descriptionLabel.text = ([json valueForKey:#"unavailable_text"]) ? [json valueForKey:#"unavailable_text"] : #"We're temporarily unavailable, please try again later."; // just in case you forget to set it have a fallback.
// present view controller...
}
Hope this helps! Let me know in comments of any questions/concerns.

Why Facebook application id suddenly become invalid?

First of all I'm sure that my fb app id is valid because users can log in my Android app using facebook credentials until some days ago (I think it's before Feb break change).
Recently new users cannot log in my Android app using facebook any more because facebook keep saying that my fb app invalid (Error is: Invalid application fb-app-id) BUT old users who already authorized my Android app for accessing their info can still log in using facebook. (Old users can still login to my app using facebook credentials but new users cannot)
Does anyone know why this happen to my facebook app and how to fix it?
Edit: When access to https://graph.facebook.com/facebook-app-id I get this error
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
Thanks you.
If you're sure the app is not in sandbox mode (which was gema.megantara's answer), and hasn't been deleted for policy reasons by Facebook the only explanation I can think of is that you've restricted the app demographically (i.e by country or age)
If that's the case the API won't return the app's details unless you make the API call using a user access token for a user who meets whatever restrictions you've applied, and users who don't meet the requirements won't be able to use the app.
If that's what you've done, you can remove the restrictions via the API (via the restrictions field of the Application object or in the ''Advanced'' tab in the app settings in the App Dashboard
If using the frontend interface to change the settings, it's the ''App Restrictions'' field you want to edit, screenshot attached
Basically the same solution as the accepted answer, just updated for the latest FB developer site has been updated so you need do this:
Apps->Your App
Status+Review
Do you want to make this app and all its live features available to the general public? -> Yes
Usually if you get error like that when visit https://graph.facebook.com/523132271032907 is because the sandbox mode is on. Have you try to reset the secret key ?
I think, this is because FB does not check whether application id is valid when the user has already logged in. It likely assumes that if the check passed, the id is valid. Apparently, locking out the users after making the app id invalid has never been a design goal.
try replacing:
<string name="facebook_app_id">CHANGE-ME</string>
with:
<string name="facebook_application_id">CHANGE-ME</string>

Categories

Resources