I have create a manual session for my users. If the user uninstalled application I want to end the session. How I can detect the user is going to uninstalled my application by then where I can perform my actions to end the session. So user can login again because I don't want to provide a logout action for user.
Asked
Active
Viewed 145 times
0
-
1Once the user uninstall the application, the session will automatically be cleared, User will always log in again – HussainAbbas Dec 21 '20 at 10:24
-
I'm not using cache. Its a server based db. – ahmad bajwa Dec 21 '20 at 10:26
-
1then can you please explain more about what type of session are you talking about? – HussainAbbas Dec 21 '20 at 10:26
-
just let me know How I can detect that my application is going to unistalled. – ahmad bajwa Dec 21 '20 at 10:27
-
1it's not possible... if you are storing the session in-app preferences then once the user uninstall the application session will also be cleared – HussainAbbas Dec 21 '20 at 10:29
-
1you can try this solution https://stackoverflow.com/questions/18692571/how-can-an-app-detect-that-its-going-to-be-uninstalled – HussainAbbas Dec 21 '20 at 10:31
-
Ok. my session are stored in live DB, then how I possibly remove session. Because I don't want my user to login more then one device. – ahmad bajwa Dec 21 '20 at 10:31
-
I already have tried that its not working for me. – ahmad bajwa Dec 21 '20 at 10:32
-
Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/226231/discussion-between-ahmad-bajwa-and-hussainabbas). – ahmad bajwa Dec 21 '20 at 10:34
-
1Usually the client sends an unique Token to the Server and this verifies it, so if the Token changes (due to new installation or by running same App on different Devices) the Server knows it. It seems your solution is "wrong" from the beginning if it doesn't works like this. – emandt Dec 21 '20 at 10:40
1 Answers
1
Sorry, It is not possible because android does not give you this facility.
By default then, all the data whether in shared preference and cache are deleted. So if you put the session in the shared preference it will automatically deleted.
But if you save any data outside the app data
(~/android/data/com.something/yourappname)
it will remain in the storage. You can save data in shared preference for your purpose. For further info please visit Action package removed Android Developer

Rezaul Karim
- 830
- 8
- 15
-
-
1No. Broadcast event only throw and received by the system( i mean OS). Its only for system – Rezaul Karim Dec 21 '20 at 11:22
-
ok, so can i create my own uninstalled activity for this. if the user try to uninstalled it will open an activity or dialog? – ahmad bajwa Dec 21 '20 at 11:23
-
1but for this reason, you have to catch the event. unfortunately there is no way to catch it – Rezaul Karim Dec 21 '20 at 11:25
-
Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/226233/discussion-between-ahmad-bajwa-and-rezaul-karim). – ahmad bajwa Dec 21 '20 at 11:35