I want to test if a service will still run after lets say, 5 days has passed. I do not want to just set the phone's time, I want the phone to think that the time has passed so that it will get rid of background apps, etc.
How do I do that in adb?
I want to test if a service will still run after lets say, 5 days has passed. I do not want to just set the phone's time, I want the phone to think that the time has passed so that it will get rid of background apps, etc.
How do I do that in adb?
I want the phone to think that the time has passed so that it will get rid of background apps, etc.
As your question is not properly clarified, there could be multiple solution to your problem, of which i have tried to address.
I use the following code in my app to get the current date:
Calendar c = Calendar.getInstance();
System.out.println("Current time => " + c.getTime());
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
AndroidDate = df.format(c.getTime());
Now with that said, all you can do is set the AndroidExpiryDate (string) and set your own date of expiry:
AndroidExpiryDate = "2016-02-28"
Then you can just compare current date (AndroidDate) with expiry date (AndroidExpiryDate ) using if statement:
if ("AndroidDate".equals("AndroidExpiryDate") )
{
//code to get rid of background app
}