A Andie Member Licensed User Longtime User Mar 30, 2018 #1 Hi, the FCM works pretty good. But there is one little problem, I can't get rid of: When a user opens my app including the FCM features for the very first time, the string variable token_id contains no value: Code: Copy token_id = fm.Token However, when the users closes the app completely so it's longer in the background and starts it again, then the variable token_id contains the token string. When the user deinstalls the app, this starts all over again, i. e. the first time, you start the app, no token is stored in token_id, you must start it a second time. From that I conclude, it's not problem of Firebase.
Hi, the FCM works pretty good. But there is one little problem, I can't get rid of: When a user opens my app including the FCM features for the very first time, the string variable token_id contains no value: Code: Copy token_id = fm.Token However, when the users closes the app completely so it's longer in the background and starts it again, then the variable token_id contains the token string. When the user deinstalls the app, this starts all over again, i. e. the first time, you start the app, no token is stored in token_id, you must start it a second time. From that I conclude, it's not problem of Firebase.
KMatle Expert Licensed User Longtime User Mar 30, 2018 #2 Please show the code part where you get the token. Must be AFTER you subscribe to a topic (even if you don't use any). If you're getting it too early, it explains why your app seems to get it at the 2nd start (because it was after the subscription anyway) Upvote 0
Please show the code part where you get the token. Must be AFTER you subscribe to a topic (even if you don't use any). If you're getting it too early, it explains why your app seems to get it at the 2nd start (because it was after the subscription anyway)
A Andie Member Licensed User Longtime User Mar 30, 2018 #3 Hi KMatle, indeed, I did subscribe for a topic although not needing it. Due to your advice I inserted a sleep command now, and ... it works: Code: Copy fm.SubscribeToTopic("dummyTopic") Sleep(1000) token_id = fm.Token Thanks a lot! Upvote 0
Hi KMatle, indeed, I did subscribe for a topic although not needing it. Due to your advice I inserted a sleep command now, and ... it works: Code: Copy fm.SubscribeToTopic("dummyTopic") Sleep(1000) token_id = fm.Token Thanks a lot!
tigrot Well-Known Member Licensed User Longtime User Mar 31, 2018 #4 There is also an event which allows to get the token when it changes. Upvote 0