当前位置: 首页>>代码示例>>Java>>正文


Java ContentResolver.getMasterSyncAutomatically方法代码示例

本文整理汇总了Java中android.content.ContentResolver.getMasterSyncAutomatically方法的典型用法代码示例。如果您正苦于以下问题:Java ContentResolver.getMasterSyncAutomatically方法的具体用法?Java ContentResolver.getMasterSyncAutomatically怎么用?Java ContentResolver.getMasterSyncAutomatically使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.ContentResolver的用法示例。


在下文中一共展示了ContentResolver.getMasterSyncAutomatically方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SyncControl20

import android.content.ContentResolver; //导入方法依赖的package包/类
public SyncControl20(Context context) {
	mContext = context;
	
	// Ensure we have this method in API ...
	// This is important for CyanogenMod 1.6, 
	// which does not fail with VerifyError like the others do, 
	// though it does not have this method either.
	ContentResolver.getMasterSyncAutomatically();
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:10,代码来源:SyncControl20.java

示例2: onHandleIntent

import android.content.ContentResolver; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    if (intent.getAction().equals(ACTION_TOGGLE_SYNC)) {
        final boolean newState;
        if (intent.hasExtra(AShortcut.EXTRA_ENABLE)) {
            newState = intent.getBooleanExtra(AShortcut.EXTRA_ENABLE, false);
        } else {
            newState = !ContentResolver.getMasterSyncAutomatically();
        }
        ContentResolver.setMasterSyncAutomatically(newState);
        if (intent.getBooleanExtra(AShortcut.EXTRA_SHOW_TOAST, false)) {
            showToast(newState ? 
                    R.string.quick_settings_sync_on :
                        R.string.quick_settings_sync_off);
        }
    } else if (intent.getAction().equals(ACTION_GET_SYNC_STATUS)) {
        boolean syncStatus = ContentResolver.getMasterSyncAutomatically();
        ResultReceiver receiver = intent.getParcelableExtra("receiver");
        Bundle data = new Bundle();
        data.putBoolean(KEY_SYNC_STATUS, syncStatus);
        receiver.send(RESULT_SYNC_STATUS, data);
    } else if (intent.getAction().equals(QuietHoursActivity.ACTION_SET_QUIET_HOURS_MODE)) {
        QuietHours.Mode qhMode = QuietHoursActivity.setQuietHoursMode(this, intent.getStringExtra(
                QuietHoursActivity.EXTRA_QH_MODE));
        if (qhMode != null && intent.getBooleanExtra(AShortcut.EXTRA_SHOW_TOAST, false)) {
            showToast(QuietHoursActivity.getToastResIdFromMode(qhMode));
        }
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:30,代码来源:GravityBoxService.java

示例3: startService

import android.content.ContentResolver; //导入方法依赖的package包/类
@Override
public int startService(Intent intent, int startId) {
    long startTime = SystemClock.elapsedRealtime();
    boolean oldIsSyncDisabled = isSyncDisabled();
    boolean doBackground = true;

    final boolean hasConnectivity = Utility.hasConnectivity(getApplication());
    boolean autoSync = ContentResolver.getMasterSyncAutomatically();

    QMail.BACKGROUND_OPS bOps = QMail.getBackgroundOps();

    switch (bOps) {
        case NEVER:
            doBackground = false;
            break;
        case ALWAYS:
            doBackground = true;
            break;
        case WHEN_CHECKED_AUTO_SYNC:
            doBackground = autoSync;
            break;
    }

    syncNoBackground = !doBackground;
    syncNoConnectivity = !hasConnectivity;
    syncBlocked = !(doBackground && hasConnectivity);

    Timber.i("MailService.onStart(%s, %d), hasConnectivity = %s, doBackground = %s",
            intent, startId, hasConnectivity, doBackground);

    // MessagingController.getInstance(getApplication()).addListener(mListener);
    if (ACTION_CHECK_MAIL.equals(intent.getAction())) {
        Timber.i("***** MailService *****: checking mail");
        if (hasConnectivity && doBackground) {
            PollService.startService(this);
        }
        reschedulePollInBackground(hasConnectivity, doBackground, startId, false);
    } else if (ACTION_CANCEL.equals(intent.getAction())) {
        startForegroundWithNotification("Fetching email");
        Timber.v("***** MailService *****: cancel");
        cancel();
    } else if (ACTION_RESET.equals(intent.getAction())) {
        startForegroundWithNotification("Fetching email");
        Timber.v("***** MailService *****: reschedule");
        rescheduleAllInBackground(hasConnectivity, doBackground, startId);
    } else if (ACTION_RESTART_PUSHERS.equals(intent.getAction())) {
        startForegroundWithNotification("Push email active");
        Timber.v("***** MailService *****: restarting pushers");
        reschedulePushersInBackground(hasConnectivity, doBackground, startId);
    } else if (ACTION_RESCHEDULE_POLL.equals(intent.getAction())) {
        startForegroundWithNotification("Polling email");
        Timber.v("***** MailService *****: rescheduling poll");
        reschedulePollInBackground(hasConnectivity, doBackground, startId, true);
    } else if (ACTION_REFRESH_PUSHERS.equals(intent.getAction())) {
        startForegroundWithNotification("Push email active");
        refreshPushersInBackground(hasConnectivity, doBackground, startId);
    } else if (CONNECTIVITY_CHANGE.equals(intent.getAction())) {
        startForegroundWithNotification("Fetching email");
        rescheduleAllInBackground(hasConnectivity, doBackground, startId);
        Timber.i("Got connectivity action with hasConnectivity = %s, doBackground = %s",
                hasConnectivity, doBackground);
    } else if (CANCEL_CONNECTIVITY_NOTICE.equals(intent.getAction())) {
        /* do nothing */
    } else {
        if (VERSION.SDK_INT >= VERSION_CODES.O)
            startForegroundWithNotification("Fetching email");
    }

    if (isSyncDisabled() != oldIsSyncDisabled) {
        MessagingController.getInstance(getApplication()).systemStatusChanged();
    }

    Timber.i("MailService.onStart took %d ms", SystemClock.elapsedRealtime() - startTime);

    return START_NOT_STICKY;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:77,代码来源:MailService.java

示例4: isSyncActivated

import android.content.ContentResolver; //导入方法依赖的package包/类
public boolean isSyncActivated() {
       return ContentResolver.getMasterSyncAutomatically();
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:4,代码来源:SyncControl20.java


注:本文中的android.content.ContentResolver.getMasterSyncAutomatically方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。