简体   繁体   中英

Is there a way to receive broadcast when uninstall dialog box appears in android?

In my app, when a user logs in, device token is stored in server database. So when user tries to log in with same account in another device, if token is already present then user is unable to log in. So I want to delete token when user account is not in that device anymore. So when user logs out, device token is deleted in server.

Problem occurs when user uninstalls app and installs again. Then user is unable to login with same account because token is not deleted in server. Is there a way to receive broadcast when dialog box 'do you want to uninstall' appears, so that token can be deleted in server?

I don't think it's possible with FCM alone. However, you can achieve this using multiple Firebase features. Just track the uninstalls using app_remove event of Google Analytics. Then, you can trigger a Cloud Function using that event in order to delete the token in your server. You can read more about it here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM