FCM token keeps changing after killing the application and reopen it - flutter

Firebase notifications works in my Flutter app, but when I kill the app and reopen it the FCM token changes.
As I know the token won't change unless the user deletes the app but in my case, the notification was not received because the token is changed.
What is the reason and how to solve it?

The FCM token changes when the app is reinstalled or the data is cleared. To receive notifications even after the app is reinstalled or data is cleared, you should store the token on the server and use it to send notifications. Additionally, you can also retrieve the latest token when the app is launched and send it to the server, so that the server has the most recent token to send notifications to.

Related

FCM token update- flutter

For fcm (Firebase Could messaging), We get a token using getToken()
I want to know,
Is the token generate one time
or
Is the token generate every time user login?
The registration token may change when:
The app is restored on a new device
The user uninstalls/reinstall the app
The user clears app data.
More :
Update from Play Store - Token remains same.
When close the application and reopen it - Token remains same.
If you want to call onTokenRefreshed() you should do it manually.
Learn more - https://firebase.google.com/docs/cloud-messaging/android/client
Additionally,
I recommend you should record that token for the user every time your app launches. Then, you don't face any problems.

How To Send Firebase Push Notification from one app to another app connect to same project

How To Send Firebase Push Notification from one app to another app connect to same project
I have Used http to send notification to specific device using token but i am unable to send to another app
I have Two App with Same Firebase project
One is Admin And Other is client
I want to send push notification from client app to Admin is this possible if yes than how.
When you have two apps installed on a single device, each of them will have a different FCM token, regardless of whether they part of the same Firebase project. So you can send a message to a specific app by sending it to the token for that app.

Delete app data from test device (iPhone)

I'm trying to delete the user's login credentials and push notifications permissions from my test iPhone 4.
When I delete the app, it still remembers the user's login credentials, and it doesn't reset the push notification opt-in permissions.
How can I reset this data?
These are two separate problems.
For the login problem, sounds like you're storing the user's login credentials on the keychain. The only way to wipe this out is to either do it via code, logging out and then deleting the app, or doing a factory reset on the device.
About resetting the push notification status, it's mentioned in an Apple Technical Note here:
https://developer.apple.com/library/ios/technotes/tn2265/_index.html
Scroll down to "Resetting the Push Notifications Permissions Alert on iOS"

will push notifications work if user has neither allowed nor "not allowed" push notifications for my app yet?

I am currently updating my App, and I am planning on including Push notifications.
The main purpose for my push notification is to let users know that the app has been updated and they should check out the new features. Now with iOS7 automatically updating apps, users are less likely to open apps after they have been updated, let alone KNOW it has been updated. As a lot of users will just clear their notification centre's with out paying any attention.
So my question is...if a user has not launched my app yet to see the alert "[myApp] would like to send you Push Notifications" - Don't Allow / OK.
Will they see my push notification before they have had chance to allow or not allow?
Do push notifications work until "not allowed" has been pressed? Or do they not work until OK has been pressed???
Thanks for your help.
If they never launched your app, your app never registered to Apple Push Notifications on their device, so you can't send them push notifications.
In addition, your server is not likely to have the device token for a device in which your app was never launched (since it's the app's job to send the device token to your server).
And if you push a notification to a device token of a device on which your app never registered to push notifications, the notification won't be delivered (even if the app is installed on the device), and that device token will eventually be returned to you in the feedback service.

Is it possible to get the device token even if Push Notification is not enabled?

I need to get the device token because I will use it for autologin. However, if the user did not allow Push Notifications from my App in his/her device, I will not be able to get the device token. I want to know if it's possible to get and store the user's device token even if he/she did not enable APN. Thanks.
Enabling/Disabling the push notification is just a setting. It doesn't stop the device from receiving the access token from APPLE
Check #Kimpoy's answer including the comments.
In my understanding on APNS, it doesn't depend on the user's action (as you mentioned that if when the user clicks on Don't Allow button) for your iOS to receive the Device Token.
If you included in your app:
- (void)application:didRegisterForRemoteNotificationsWithDeviceToken
This means that your iOS-based app is sending a request for Push Notification registration. In return, Apple sends the Device Token to the iOS; then the iOS sends the token to the app and then the app sends it to their service provider.
Not that when the user is asked "Don't Allow" doesn't mean that you're not going to receive the device token. Don't Allow refers to the action to be taken to any notification received by the app that is intended for the user. Say, location. This is a whole different thing. This means that the user doesn't allow the app to use his/her location.
Yes, it still receives the Device Token as what I have discussed in my answer to your question in #1. This is only a setting for your app, which means that you won't be receiving any visible notification (badge, message or a sound) whenever there are updates about any information in relevance to your application. It's like setting your Facebook account to only receive notifications when your friends sends you a private message. Other than that, you won't be notified at all.
The process of enabling APNS is:
Request for certificate Authority
Create app id
Configuring AppId for Push Notifications
Create provisioning profile
Provisioning a device
Enabling the profile in Xcode
Creating push notification provider.
For more understanding on APNS, check out this.
You still can get the device token even if the user disables it.