updated checkin

This commit is contained in:
X1nto 2020-07-27 21:10:05 +04:00
parent 75a93f052e
commit 9b7680f915
6 changed files with 2 additions and 6 deletions

View File

@ -33,8 +33,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;
public class CheckinManager {
private static final long MIN_CHECKIN_INTERVAL = 3 * 60 * 60 * 1000; // 3 hours
@ -43,7 +41,7 @@ public class CheckinManager {
LastCheckinInfo info = LastCheckinInfo.read(context);
if (!force && info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL)
return null;
if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PREF_ENABLE_CHECKIN, true))
if (!CheckinPrefs.get(context).isEnabled())
return null;
List<CheckinClient.Account> accounts = new ArrayList<CheckinClient.Account>();
AccountManager accountManager = AccountManager.get(context);

View File

@ -34,8 +34,6 @@ import org.microg.gms.common.ForegroundServiceContext;
import org.microg.gms.gcm.McsService;
import org.microg.gms.people.PeopleManager;
import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;
public class CheckinService extends IntentService {
private static final String TAG = "GmsCheckinSvc";
public static final String BIND_ACTION = "com.google.android.gms.checkin.BIND_TO_SERVICE";
@ -58,7 +56,7 @@ public class CheckinService extends IntentService {
protected void onHandleIntent(Intent intent) {
try {
ForegroundServiceContext.completeForegroundService(this, intent, TAG);
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PREF_ENABLE_CHECKIN, true)) {
if (CheckinPrefs.get(this).isEnabled()) {
LastCheckinInfo info = CheckinManager.checkin(this, intent.getBooleanExtra(EXTRA_FORCE_CHECKIN, false));
if (info != null) {
Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId));