iOS Question Firebase messaging token - detect app uninstall

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone.. i've a big problem, i must know if a user has uninstalled the app.
I use firebase messaging to send push notification using a token.
There is a way to know if a user has deleted the app?

I read that maybe using the fact that the firebase token became invalid after a while... but i tried to send a notification to a old token (some hours after i deleted the app) but the firebase response says:
success: 1, failure: 0

so my question is: Will a token of an uninstalled app ever become invalid? If yes, someone knows after how much time it happens? Someone has some other suggetions to detect if the user deleted the app?

Thanks to everyone, I hope to receive some tips!
 

Mike1970

Well-Known Member
Licensed User
Longtime User
No simple way.

I wouldn't rely on Firebase tokens for this. Run your own simple server and let the app connect to this server when it starts. If an app wasn't started for X days you can treat it as inactive.
No simple way.

I wouldn't rely on Firebase tokens for this. Run your own simple server and let the app connect to this server when it starts. If an app wasn't started for X days you can treat it as inactive.


Yes Erel, I already thought this possibility, my problem is that in some cases its normal that an user doesn't open the app for a while..so this type of situation doesn't let me to understand in a reliable way if the user deleted the app, or isn't just using it..
Thanks anyway!
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Your app also starts when a push notification is received.

OMG... in iOS?
I based all my reasoning on the fact that an iOS app does not starts when a push notification is received...

Cattura.PNG

Like you said in this tutorial

Maybe have i misunderstood? In this case in wich sub can i run some code to connect to my server with an http job?
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
If you talk about uninstalling your program, you can do, for example
B4X:
If File.Exists (File.DirDocuments, "Test") = False Then Log ("First time or after uninstall") Else Log ("Not after uninstall")
File.MakeDir (File.DirDocuments, "Test")

When user uninstalls your app, File.Documents will be removed.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
If you talk about uninstalling your program, you can do, for example
B4X:
If File.Exists (File.DirDocuments, "Test") = False Then Log ("First time or after uninstall") Else Log ("Not after uninstall")
File.MakeDir (File.DirDocuments, "Test")

When user uninstalls your app, File.Documents will be removed.

Not quite, i explain.

Perfect case (no issues)
I have an app that is used from a person.
This person send a sort of message containing the phone number (and other data) of the recipient to my server.
My server checks if the phone number is registered to my service, if not, It sends an sms to it, else it sends a push notification to the app of the recipient (firebase).


Bad case
If the recipient uninstall the app, in my system he will be considered as "registered" for ever, because I couldn't intercept the fact that he deleted the app.
So: if the sender sends the message as before, but the recipient has deleted the app, he will never receive the push notification because he deleted the app, and no sms because my system knows that phone number as "registered"
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Sorry. Sorry. I thought that we are in the B4A forum...

No. The notification will not start your app in iOS. However monitoring the last time when your app was actually opened is still a good measure to decide whether your app is active or not.

You opened a glorious door to me for a moment šŸ˜‚.
Don't worry.
I will think about some sort of algorithm.

Thanks!
 
Upvote 0
Top