0

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.

ahmad bajwa
  • 966
  • 2
  • 10
  • 30
  • 1
    Once 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
  • 1
    then 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
  • 1
    it'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
  • 1
    you 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
  • 1
    Usually 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 Answers1

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