Changing The Internal Android Simulator's Time
I'm in the process of creating an android app that makes extensive use of the time & date functions in android, including many uses of AlarmManager. For testing though, it's a
Solution 1:
Just do it as you would in a normal handset:
Settings -> Date & Time, then disable Automatic and set the Date and Time
Solution 2:
Now I found a solution, which makes it easier to reset the simulator to a specific time without doing this manually every time.
- Start a simulator, where you can get root access (simulator without Play Store)
- Open Android Adb Command Prompt
- Get root access with
adb root
- Connect to the shell of the emulator with
adb -e shell
or to a specific emulator withadb -s emulator-5553 shell
- Change the date and broadcast it immediately with e.g.
date 112509412020.00 ; am broadcast -a android.intent.action.TIME_SET
(time format ist MMDDhhmmYYYY.00) - You should see the new time in the simulator and get this on the shell Broadcast completed: result=0
But you still have to call the last command every time to reset it ...
Post a Comment for "Changing The Internal Android Simulator's Time"