當前位置: 首頁>>代碼示例>>Java>>正文


Java Intent.ACTION_BOOT_COMPLETED屬性代碼示例

本文整理匯總了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));
}
 
開發者ID:PrivacyStreams,項目名稱:PrivacyStreams,代碼行數:76,代碼來源:DeviceEventUpdatesProvider.java

示例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");
}
 
開發者ID:monthlypub,項目名稱:SmingZZick_App,代碼行數:25,代碼來源:AttackReciver.java

示例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;
    }
}
 
開發者ID:Maxr1998,項目名稱:home-assistant-Android,代碼行數:23,代碼來源:LocationUpdateReceiver.java

示例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;
    }
}
 
開發者ID:Maxr1998,項目名稱:home-assistant-Android,代碼行數:24,代碼來源:LocationUpdateReceiver.java

示例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;
    }
}
 
開發者ID:Eun,項目名稱:InitialVolume,代碼行數:20,代碼來源:Service.java

示例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)));
}
 
開發者ID:Doist,項目名稱:JobSchedulerCompat,代碼行數:7,代碼來源:JobGcReceiverTest.java

示例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;

    }
}
 
開發者ID:brolam,項目名稱:OpenHomeAnalysis,代碼行數:15,代碼來源:OhaBroadcast.java

示例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;
    }
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:13,代碼來源:NotificationRunner.java

示例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();
}
 
開發者ID:mwsrc,項目名稱:Dendroid-HTTP-RAT,代碼行數:9,代碼來源:MyService.java

示例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;
    }
}
 
開發者ID:Eun,項目名稱:StartBluetooth,代碼行數:13,代碼來源:Service.java

示例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


注:本文中的android.content.Intent.ACTION_BOOT_COMPLETED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。