I’m working on a Text To Speech. Imagine an application with a 30 activites. The Activity 1 is triggered on the phone is turned on. That is, the application is set to Default.
Well, whenever the phone is switched on, the application is loaded. I need to synthesize speech: “System Ready”. But it would be something in onResume () in Activity 1. Whenever the user is in another activity and trigger HOME button on the phone, an Activity is loaded again. I can not speak “System Ready” again or every time the user back to the Activity # 1 is the Default Phone Application
I needed a kind of SharedPreference it was destroyed on the phone is turned off and kept in memory while the phone is switched on. So, I can verify this in onResume () in Activity 1 and check if it has been spoken “System Ready”
Sorry for bad English.
Could anyone help me solve this?
If you want to remove your sharedpreference when phone is switching off, you will have to register a receiver which will get notified when device is switching off. Android system broadcasts an intent ACTION_SHUTDOWN. So you can handle it and can remove your sharedpreference.