android.content.Context#removeStickyBroadcast ( )源码实例Demo

下面列出了android.content.Context#removeStickyBroadcast ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: commcare-android   文件: FormEntryActivity.java
private void registerFormEntryReceiver() {
    //BroadcastReceiver for:
    // a) An unresolvable xpath expression encountered in PollSensorAction.onLocationChanged
    // b) Checking if GPS services are not available
    mLocationServiceIssueReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            context.removeStickyBroadcast(intent);
            badLocationXpath = intent.getStringExtra(PollSensorAction.KEY_UNRESOLVED_XPATH);
            locationRecieverErrorAction = intent.getAction();
        }
    };

    IntentFilter filter = new IntentFilter();
    filter.addAction(PollSensorAction.XPATH_ERROR_ACTION);
    filter.addAction(GeoUtils.ACTION_CHECK_GPS_ENABLED);
    registerReceiver(mLocationServiceIssueReceiver, filter);
}
 
源代码2 项目: JobSchedulerCompat   文件: DeviceTestUtils.java
@SuppressWarnings("deprecation")
public static void setStorageNotLow(Context context, boolean storageNotLow) {
    Intent storageLowIntent = new Intent(Intent.ACTION_DEVICE_STORAGE_LOW);
    if (storageNotLow) {
        context.removeStickyBroadcast(storageLowIntent);
    } else {
        context.sendStickyBroadcast(storageLowIntent);
    }
}
 
 方法所在类
 同类方法