Hello, I’m working on an App that recieves notifications, but I’m facing a problem. There is an event called “remoteRegistration” which is called when the app tries to register with google, which I (from reading other topics in this forum) assumed was called only on the fisrt launch, but it turns out it doesn’t.
As a result, my phone has registered with the server for notifications like 6 times, which would become a serious issue when lots of users launched the app lots of time.
local function onNotification(event) if event.type == "remoteRegistration" then googleRegistrationId = event.token -- register with google and the server
So, what is de correct way to prevent this? to save googleRegisterID on a file in the phone, and then place another codition beside event.type==“remoteRegistration” to check for the existence of such a file or is there a ‘cleaner´’ way to achieve this?
The other problem (which I don’t see a solution for) is that while testing I noticed that when I uninstall the App, it still appears on the server’s database as an entry, so I would need to send an instruction to the server to delete it. Is there a way to execute a piece of code during de uninstalling of an App so I can tell de server to remove the user, or how should I approach this problem?
Tanks!