本文整理汇总了Java中android.content.Intent.ACTION_BOOT_COMPLETED属性的典型用法代码示例。如果您正苦于以下问题:Java Intent.ACTION_BOOT_COMPLETED属性的具体用法?Java Intent.ACTION_BOOT_COMPLETED怎么用?Java Intent.ACTION_BOOT_COMPLETED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.ACTION_BOOT_COMPLETED属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
@Override
public void onReceive(Context context, Intent intent) {
String event = null;
String type = null;
switch(intent.getAction()){
case Intent.ACTION_SCREEN_OFF:
event = DeviceEvent.EVENT_SCREEN_OFF;
type = DeviceEvent.TYPE_SCREEN;
break;
case Intent.ACTION_SCREEN_ON:
event = DeviceEvent.EVENT_SCREEN_ON;
type = DeviceEvent.TYPE_SCREEN;
break;
case Intent.ACTION_USER_PRESENT:
event = DeviceEvent.EVENT_SCREEN_USER_PRESENT;
type = DeviceEvent.TYPE_SCREEN;
break;
case Intent.ACTION_BOOT_COMPLETED:
event = DeviceEvent.EVENT_BOOT_COMPLETED;
type = DeviceEvent.TYPE_BOOT;
break;
case Intent.ACTION_SHUTDOWN:
event = DeviceEvent.EVENT_BOOT_SHUTDOWN;
type = DeviceEvent.TYPE_BOOT;
break;
case Intent.ACTION_BATTERY_LOW:
event = DeviceEvent.EVENT_BATTERY_LOW;
type = DeviceEvent.TYPE_BATTERY;
break;
case Intent.ACTION_BATTERY_OKAY:
event = DeviceEvent.EVENT_BATTERY_OKAY;
type = DeviceEvent.TYPE_BATTERY;
break;
case Intent.ACTION_POWER_CONNECTED:
event = DeviceEvent.EVENT_BATTERY_AC_CONNECTED;
type = DeviceEvent.TYPE_BATTERY;
break;
case Intent.ACTION_POWER_DISCONNECTED:
event = DeviceEvent.EVENT_BATTERY_AC_DISCONNECTED;
type = DeviceEvent.TYPE_BATTERY;
break;
case AudioManager.RINGER_MODE_CHANGED_ACTION:
AudioManager am = (AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE);
switch (am.getRingerMode()) {
case AudioManager.RINGER_MODE_SILENT:
event = DeviceEvent.EVENT_RINGER_SILENT;
type = DeviceEvent.TYPE_RINGER;
break;
case AudioManager.RINGER_MODE_VIBRATE:
event = DeviceEvent.EVENT_RINGER_VIBRATE;
type = DeviceEvent.TYPE_RINGER;
break;
case AudioManager.RINGER_MODE_NORMAL:
event = DeviceEvent.EVENT_RINGER_NORMAL;
type = DeviceEvent.TYPE_RINGER;
break;
}
default:
break;
}
if (type != null)
output(new DeviceEvent(type, event));
}
示例2: onReceive
@Override
public void onReceive(Context context, Intent intent) {
// TODO: This method is called when the BroadcastReceiver is receiving
// an Intent broadcast.
String action = intent.getAction();
switch (action) {
case ACTION_ATTACK_NOTI :
notiAttack(context, intent);
return;
case ACTION_SMING_NOTI :
notiMakeTime(context, intent);
return;
case ACTION_ATTACK_NOTI_CLICK :
clickAttackNoti(context, intent);
return;
case Intent.ACTION_BOOT_COMPLETED :
case Intent.ACTION_MY_PACKAGE_REPLACED :
AttackManager.getInstance().clearMakeTimeNoti(context);
AttackManager.getInstance().registMakeTimeNoti(context);
AttackManager.getInstance().refreshAttackAlarm(context);
return;
}
throw new UnsupportedOperationException("Not yet implemented");
}
示例3: onReceive
@Override
public void onReceive(Context context, Intent intent) {
prefs = Utils.getPrefs(context);
switch (intent.getAction()) {
case Intent.ACTION_BOOT_COMPLETED:
case ACTION_START_LOCATION:
tempContext = context;
apiClient = new LostApiClient.Builder(context)
.addConnectionCallbacks(this)
.build();
apiClient.connect();
break;
case ACTION_LOCATION_UPDATE:
if (prefs.getBoolean(Common.PREF_ENABLE_LOCATION_TRACKING, false) && LocationResult.hasResult(intent)) {
LocationResult result = LocationResult.extractResult(intent);
Location location = result.getLastLocation();
if (location != null)
logLocation(location, context);
}
break;
}
}
示例4: onReceive
@Override
public void onReceive(Context context, Intent intent) {
prefs = Utils.getPrefs(context);
switch (intent.getAction()) {
case Intent.ACTION_BOOT_COMPLETED:
case ACTION_START_LOCATION:
apiClient = new GoogleApiClient.Builder(context)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
apiClient.connect();
break;
case ACTION_LOCATION_UPDATE:
if (prefs.getBoolean(Common.PREF_ENABLE_LOCATION_TRACKING, false) && LocationResult.hasResult(intent)) {
LocationResult result = LocationResult.extractResult(intent);
Location location = result.getLastLocation();
if (location != null)
logLocation(location, context);
}
break;
}
}
示例5: onReceive
@Override
public void onReceive(Context context, Intent intent) {
SharedPreferences prefs;
switch (intent.getAction()) {
case Intent.ACTION_BOOT_COMPLETED:
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
context.getApplicationContext().registerReceiver(this, filter);
prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getBoolean(context.getString(R.string.pref_set_on_boot), false)) {
setVolume(context);
}
break;
case Intent.ACTION_SCREEN_ON:
prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getBoolean(context.getString(R.string.pref_set_on_screen_on), false)) {
setVolume(context);
}
break;
}
}
示例6: testBootReceiverRegistered
@Test
public void testBootReceiverRegistered() {
Intent intent = new Intent(Intent.ACTION_BOOT_COMPLETED);
AndroidManifest manifest = ShadowApplication.getInstance().getAppManifest();
List<BroadcastReceiver> receivers = ShadowApplication.getInstance().getReceiversForIntent(intent);
assertThat(receivers, hasItem(isA(JobGcReceiver.class)));
}
示例7: onReceive
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case START_SYNC_ENERGY_USE:
OhaSyncService.start(context);
return;
case Intent.ACTION_BOOT_COMPLETED:
OhaSyncService.start(context);
return;
case ConnectivityManager.CONNECTIVITY_ACTION:
OhaSyncService.start(context);
return;
}
}
示例8: onReceive
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case Intent.ACTION_BOOT_COMPLETED:
if(new ApplicationPrefs(context).isAuthenticated()) {
if (new DefaultPreferences(context).isNotificationEnabled())
new ServiceScheduler(context).scheduleJob();
else
new ServiceScheduler(context).cancelJob();
}
break;
}
}
示例9: onCreate
@Override
public void onCreate() {
IntentFilter filterBoot = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
filterBoot.addAction(Intent.ACTION_SCREEN_OFF);
mReceiver = new ServiceReceiver();
registerReceiver(mReceiver, filterBoot);
super.onCreate();
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putLong("inacall", 0).commit();
}
示例10: onReceive
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case Intent.ACTION_BOOT_COMPLETED:
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
context.getApplicationContext().registerReceiver(this, filter);
setBluetooth(context, R.string.pref_set_on_boot);
break;
case Intent.ACTION_SCREEN_ON:
setBluetooth(context, R.string.pref_set_on_screen_on);
break;
}
}
示例11: onReceive
@Override
public void onReceive(Context context, Intent intent) {
Bundle extras = intent.getExtras();
switch (intent.getAction()) {
case TvContractCompat.ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED:
// Notice that the user has removed a preview program.
// The app should remove the program from the channel and should never publish it
// again. The app could use this as an indication that the user is no longer
// interested in watching this type of content.
Log.d(TAG, "preview program browsable disabled");
break;
case TvContractCompat.ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED:
// Notice that the user has removed a program from the watch next list.
Log.d(TAG, "watch next program browsable disabled");
break;
case TvContractCompat.ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT:
// Notice that the user has added a preview program to their watch next list. Use
// this information to update internal data structures or as an indication of the
// user's interest in this type of programming.
// From that point on, the app is responsible for this program and should treat it
// like other programs in a channel.
Log.d(TAG, "preview program added to watch next preview " +
extras.getString(TvContractCompat.EXTRA_PREVIEW_PROGRAM_ID)
+ " watch-next "
+ extras.getString(TvContractCompat.EXTRA_WATCH_NEXT_PROGRAM_ID));
break;
case Intent.ACTION_BOOT_COMPLETED:
// Notice that the device has just finished booting. Use this opportunity to publish
// the initial list of channels to the launcher. This intent is useful for the
// preinstalled apps on the device. Apps that can be installed from the Play Store
// should use ACTION_INITIALIZE_PROGRAMS as the signal to start posting their
// channels.
Log.d(TAG, "ACTION_BOOT_COMPLETED received");
break;
case TvContractCompat.ACTION_INITIALIZE_PROGRAMS:
// Notice that the app was just installed from the Play Store. Use this opportunity
// to publish the initial list of channels to the launcher. This intent is useful
// for apps that don't come "pre-installed" and are installed via Play Store.
Log.d(TAG, "ACTION_INITIALIZE_PROGRAMS received");
break;
}
}
开发者ID:googlesamples,项目名称:leanback-homescreen-channels,代码行数:44,代码来源:LauncherNotificationReceiver.java