Skip to content Skip to sidebar Skip to footer

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.

  1. Start a simulator, where you can get root access (simulator without Play Store)
  2. Open Android Adb Command Prompt
  3. Get root access with adb root
  4. Connect to the shell of the emulator with adb -e shell or to a specific emulator with adb -s emulator-5553 shell
  5. 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)
  6. 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"