-1

In my application I have saved user data in Application class. Location service is using in the app. When location permission is turned off manually from settings and go to the app , userdata saved in application class returns null. I couldn't figure out the issue, no one is raised such an issue before. Please help me. I have googled a lot. No solution is found.

Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95
user1767260
  • 1,543
  • 8
  • 26
  • 51

1 Answers1

1

A pattern that is sometimes suggested is to save your data in the Application object with the idea that it will be available across all activities. This solution is simple but it is wrong.When Android silently kills the app to reclaim some memory.so application variable can be null.So solution is keeping those in persistent storage.

Krutik
  • 732
  • 6
  • 19