本文整理匯總了Java中android.content.Context.sendStickyBroadcast方法的典型用法代碼示例。如果您正苦於以下問題:Java Context.sendStickyBroadcast方法的具體用法?Java Context.sendStickyBroadcast怎麽用?Java Context.sendStickyBroadcast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.content.Context
的用法示例。
在下文中一共展示了Context.sendStickyBroadcast方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setCharging
import android.content.Context; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public static void setCharging(Context context, boolean charging) {
Intent chargingIntent = new Intent(Intent.ACTION_BATTERY_CHANGED);
if (charging) {
chargingIntent.putExtra(BatteryManager.EXTRA_PLUGGED, BatteryManager.BATTERY_PLUGGED_AC);
}
context.sendStickyBroadcast(chargingIntent);
}
示例2: setStorageNotLow
import android.content.Context; //導入方法依賴的package包/類
@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);
}
}
示例3: attachToActivityManagerService
import android.content.Context; //導入方法依賴的package包/類
private static void attachToActivityManagerService(Context context) {
LogControler.print(Level.INFO, "[ServerManagerThread] attach To ActivityManagerService");
Intent intent = new Intent(ServiceContext.ACTION_RECEIVE_SERVICE_MANAGER);
Bundle binderBunder = new Bundle();
binderBunder.putBinder(ServiceContext.EXTRA_BUNDLE_BINDER, ServiceManagerThread.getDefault());
intent.putExtra(ServiceContext.EXTRA_BUNDLE, binderBunder);
intent.putExtra(ServiceContext.EXTRA_COMMAND, ServiceContext.CMD_CREATE_CLIENT_SERVICE_MANAGER);
context.sendStickyBroadcast(intent);
}