Home > other >  activate features the next day in android
activate features the next day in android

Time:07-31

Good morning, i'm new to Android and i'm developing an app which the day after the installation it should start another activity, does someone know how to activate features or do something the next day android?

Something like:

if(today.equals(thenextday)){
//then load the feature
}else{
//wait the user for the next day
}

Thanks.

CodePudding user response:

What you can do is save the date inside shared preferences when the app is first launched. You can write code with the following logic: when you launch the activity first day, shared preferences will have an empty date value then you can store the current date in shared preference. When the user opens the app the next day, the current date value will be changed, you can check if the date is changed and execute the code that you want to enable the features. To save memory, you can also store a boolean value for the first time as false and change it to true if the date has changed. This way, you can clear shared preferences if the next time user opens the app boolean saved is true.

  • Related