I am developing application in which is based on Login-Logout
mechanism along with REST API
integration.
For making REST API
request TOKEN
is required. Application is saving this TOKEN
and other user details to SharedPreferences
.
When User logged in application saves all required data and at logout time all data is removed from SharedPreferences
and TOKEN
entry is deleted from application server
Application also register with GCM server
for sending push notification to user. For that application sends Device Register Id to application server.
But if User clears application data or uninstall then application will open login screen and register again with application server and GCM server so old entry remains in application server and new entry is added to server.
So if server send push notification to application then two push notification receives in device.
Is there any way to detect programatically if application data is cleared or application is uninstalled?
Any help will be appreciated.