Even if you can find some kind of hack this, this is not what you want to do. The best solution would be to listen for the ACTION_TIMEZONE_CHANGED, ACTION_TIME_CHANGED and ACTION_DATE_CHANGED events, and then change your previous time accordingly. This is actually very easy to do, I can provide sample code if you need help.
TimeChanged.java
package com.example.stackoverflow17462606; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class TimeChanged extends BroadcastReceiver { public TimeChanged() { } @Override public void onReceive(Context context, Intent intent) {
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.stackoverflow17462606" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <receiver android:name="com.example.stackoverflow17462606.TimeChanged" android:enabled="true" android:exported="true" > <intent-filter> <action android:name="android.intent.action.TIMEZONE_CHANGED"/> <action android:name="android.intent.action.TIME_SET"/> <action android:name="android.intent.action.DATE_CHANGED"/> </intent-filter> </receiver> </application> </manifest>
Remember that this will only work if you once launched the application on the device (to prevent applications from starting after installation)
source share