mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-13 08:01:33 +01:00
use SystemClock.elapsedRealtime() rather than 0 as initial fire time
when setting background update timer.
This commit is contained in:
parent
c12f64cc03
commit
2d7ac8e7b0
1 changed files with 7 additions and 5 deletions
|
@ -33,6 +33,7 @@ import android.content.Intent;
|
|||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.os.SystemClock;
|
||||
import java.net.Socket;
|
||||
import java.io.InputStream;
|
||||
import java.io.DataInputStream;
|
||||
|
@ -53,10 +54,8 @@ public class RelayReceiver extends BroadcastReceiver {
|
|||
RestartTimer( context );
|
||||
} else {
|
||||
// DbgUtils.logf( "RelayReceiver::onReceive()" );
|
||||
// if ( XWConstants.s_showProxyToast ) {
|
||||
// Toast.makeText(context, "RelayReceiver: fired",
|
||||
// Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
// Toast.makeText(context, "RelayReceiver: fired",
|
||||
// Toast.LENGTH_SHORT).show();
|
||||
Intent service = new Intent( context, RelayService.class );
|
||||
context.startService( service );
|
||||
}
|
||||
|
@ -83,7 +82,10 @@ public class RelayReceiver extends BroadcastReceiver {
|
|||
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
|
||||
|
||||
if ( force || interval_millis > 0 ) {
|
||||
long first_millis = force ? 0 : interval_millis;
|
||||
long first_millis = SystemClock.elapsedRealtime();
|
||||
if ( !force ) {
|
||||
first_millis += interval_millis;
|
||||
}
|
||||
am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
|
||||
first_millis, // first firing
|
||||
interval_millis, pi );
|
||||
|
|
Loading…
Reference in a new issue