/frameworks/opt/setupwizard/library/test/src/com/android/setupwizardlib/test/ |
D | WizardManagerHelperTest.java | 30 final Intent intent = new Intent("test.intent.ACTION"); in testGetNextIntent() local 31 intent.putExtra("scriptUri", "android-resource://test-script"); in testGetNextIntent() 32 intent.putExtra("actionId", "test_action_id"); in testGetNextIntent() 33 intent.putExtra("theme", "test_theme"); in testGetNextIntent() 34 intent.putExtra("ignoreExtra", "poof"); // extra is ignored because it's not known in testGetNextIntent() 40 WizardManagerHelper.getNextIntent(intent, Activity.RESULT_OK, data); in testGetNextIntent() 58 final Intent intent = new Intent(); in testIsSetupWizardTrue() local 59 intent.putExtra("firstRun", true); in testIsSetupWizardTrue() 61 WizardManagerHelper.isSetupWizardIntent(intent)); in testIsSetupWizardTrue() 66 final Intent intent = new Intent(); in testIsSetupWizardFalse() local [all …]
|
/frameworks/base/core/java/android/app/admin/ |
D | DeviceAdminReceiver.java | 408 public void onEnabled(Context context, Intent intent) { in onEnabled() argument 422 public CharSequence onDisableRequested(Context context, Intent intent) { in onDisableRequested() argument 434 public void onDisabled(Context context, Intent intent) { in onDisabled() argument 445 public void onPasswordChanged(Context context, Intent intent) { in onPasswordChanged() argument 456 public void onPasswordFailed(Context context, Intent intent) { in onPasswordFailed() argument 467 public void onPasswordSucceeded(Context context, Intent intent) { in onPasswordSucceeded() argument 488 public void onPasswordExpiring(Context context, Intent intent) { in onPasswordExpiring() argument 513 public void onProfileProvisioningComplete(Context context, Intent intent) { in onProfileProvisioningComplete() argument 526 public void onReadyForUserInitialization(Context context, Intent intent) { in onReadyForUserInitialization() argument 536 public void onLockTaskModeEntering(Context context, Intent intent, String pkg) { in onLockTaskModeEntering() argument [all …]
|
/frameworks/base/tests/SystemUIDemoModeController/src/com/example/android/demomodecontroller/ |
D | DemoModeController.java | 225 final Intent intent = new Intent("com.android.systemui.demo"); in exitDemoMode() local 226 intent.putExtra("command", "exit"); in exitDemoMode() 227 mContext.sendBroadcast(intent); in exitDemoMode() 234 final Intent intent = new Intent("com.android.systemui.demo"); 235 intent.putExtra("command", "status"); 236 intent.putExtra("volume", mStatusSlots < 1 ? "hide" 238 intent.putExtra("bluetooth", mStatusSlots < 3 ? "hide" 240 intent.putExtra("location", mStatusSlots < 5 ? "hide" : "show"); 241 intent.putExtra("alarm", mStatusSlots < 6 ? "hide" : "show"); 242 intent.putExtra("sync", mStatusSlots < 7 ? "hide" : "show"); [all …]
|
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/ |
D | GridWidgetTest.java | 354 private void initActivity(Intent intent) { in initActivity() argument 355 setActivityIntent(intent); in initActivity() 373 Intent intent = new Intent(mInstrumentation.getContext(), GridActivity.class); in testThreeRowHorizontalBasic() local 374 intent.putExtra(GridActivity.EXTRA_LAYOUT_RESOURCE_ID, R.layout.horizontal_grid); in testThreeRowHorizontalBasic() 375 intent.putExtra(GridActivity.EXTRA_NUM_ITEMS, 100); in testThreeRowHorizontalBasic() 376 initActivity(intent); in testThreeRowHorizontalBasic() 443 Intent intent = new Intent(mInstrumentation.getContext(), GridActivity.class); in testItemDecorationAndMargins() local 444 intent.putExtra(GridActivity.EXTRA_LAYOUT_RESOURCE_ID, R.layout.vertical_linear); in testItemDecorationAndMargins() 445 intent.putExtra(GridActivity.EXTRA_ITEMS, new int[]{itemHeight, itemHeight, itemHeight}); in testItemDecorationAndMargins() 446 intent.putExtra(GridActivity.EXTRA_LAYOUT_MARGINS, in testItemDecorationAndMargins() [all …]
|
/frameworks/support/v7/mediarouter/src/android/support/v7/media/ |
D | RemotePlaybackClient.java | 339 Intent intent = new Intent(action); in playOrEnqueue() local 340 intent.setDataAndType(contentUri, mimeType); in playOrEnqueue() 341 intent.putExtra(MediaControlIntent.EXTRA_ITEM_STATUS_UPDATE_RECEIVER, in playOrEnqueue() 344 intent.putExtra(MediaControlIntent.EXTRA_ITEM_METADATA, metadata); in playOrEnqueue() 347 intent.putExtra(MediaControlIntent.EXTRA_ITEM_CONTENT_POSITION, positionMillis); in playOrEnqueue() 349 performItemAction(intent, mSessionId, null, extras, callback); in playOrEnqueue() 384 Intent intent = new Intent(MediaControlIntent.ACTION_SEEK); in seek() local 385 intent.putExtra(MediaControlIntent.EXTRA_ITEM_CONTENT_POSITION, positionMillis); in seek() 386 performItemAction(intent, mSessionId, itemId, extras, callback); in seek() 415 Intent intent = new Intent(MediaControlIntent.ACTION_GET_STATUS); in getStatus() local [all …]
|
/frameworks/base/packages/SystemUI/src/com/android/systemui/tuner/ |
D | DemoModeFragment.java | 151 Intent intent = new Intent(DemoMode.ACTION_DEMO); in startDemoMode() local 153 intent.putExtra(DemoMode.EXTRA_COMMAND, DemoMode.COMMAND_ENTER); in startDemoMode() 154 getContext().sendBroadcast(intent); in startDemoMode() 156 intent.putExtra(DemoMode.EXTRA_COMMAND, DemoMode.COMMAND_CLOCK); in startDemoMode() 157 intent.putExtra("hhmm", "0700"); in startDemoMode() 158 getContext().sendBroadcast(intent); in startDemoMode() 160 intent.putExtra(DemoMode.EXTRA_COMMAND, DemoMode.COMMAND_NETWORK); in startDemoMode() 161 intent.putExtra("wifi", "show"); in startDemoMode() 162 intent.putExtra("mobile", "show"); in startDemoMode() 163 intent.putExtra("sims", "1"); in startDemoMode() [all …]
|
/frameworks/support/customtabs/tests/src/android/support/customtabs/ |
D | CustomTabsIntentTest.java | 40 Intent intent = customTabsIntent.intent; in testBareboneCustomTabIntent() local 41 assertNotNull(intent); in testBareboneCustomTabIntent() 44 assertEquals(Intent.ACTION_VIEW, intent.getAction()); in testBareboneCustomTabIntent() 45 assertTrue(intent.hasExtra(CustomTabsIntent.EXTRA_SESSION)); in testBareboneCustomTabIntent() 47 assertNull(intent.getExtras().getBinder(CustomTabsIntent.EXTRA_SESSION)); in testBareboneCustomTabIntent() 49 assertNull(intent.getComponent()); in testBareboneCustomTabIntent() 55 Intent intent = new CustomTabsIntent.Builder().setToolbarColor(color).build().intent; in testToolbarColor() local 56 assertTrue(intent.hasExtra(CustomTabsIntent.EXTRA_TOOLBAR_COLOR)); in testToolbarColor() 57 assertEquals(color, intent.getIntExtra(CustomTabsIntent.EXTRA_TOOLBAR_COLOR, 0)); in testToolbarColor() 64 Intent intent = new CustomTabsIntent.Builder().setToolbarColor(colorId).build().intent; in testToolbarColorIsNotAResource() local [all …]
|
/frameworks/base/packages/Osu/src/com/android/hotspot2/ |
D | AppBridge.java | 32 Intent intent = new Intent(ACTION_OSU_NOTIFICATION); in showOsuCount() local 33 intent.putExtra(OSU_COUNT, osuCount); in showOsuCount() 34 intent.setFlags( in showOsuCount() 37 mContext.startActivity(intent); in showOsuCount() 42 Intent intent = new Intent(ACTION_OSU_NOTIFICATION); in showStatus() local 43 intent.putExtra(SP_NAME, spName); in showStatus() 44 intent.putExtra(PROV_SUCCESS, status == OSUOperationStatus.ProvisioningSuccess); in showStatus() 46 intent.putExtra(PROV_MESSAGE, message); in showStatus() 48 intent.setFlags( in showStatus() 50 mContext.startActivity(intent); in showStatus() [all …]
|
/frameworks/base/services/tests/servicestests/src/com/android/server/ |
D | BroadcastInterceptingContext.java | 56 public boolean dispatchBroadcast(Intent intent) { in dispatchBroadcast() argument 57 if (mFilter.match(getContentResolver(), intent, false, TAG) > 0) { in dispatchBroadcast() 60 mReceiver.onReceive(context, intent); in dispatchBroadcast() 63 set(intent); in dispatchBroadcast() 125 public void sendBroadcast(Intent intent) { in sendBroadcast() argument 130 if (interceptor.dispatchBroadcast(intent)) { in sendBroadcast() 138 public void sendBroadcast(Intent intent, String receiverPermission) { in sendBroadcast() argument 139 sendBroadcast(intent); in sendBroadcast() 143 public void sendBroadcastMultiplePermissions(Intent intent, String[] receiverPermissions) { in sendBroadcastMultiplePermissions() argument 144 sendBroadcast(intent); in sendBroadcastMultiplePermissions() [all …]
|
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/ |
D | LauncherActivity.java | 63 Intent intent = findTask(activities); in onCreate() local 64 if (intent != null) { in onCreate() 65 restoreTask(intent); in onCreate() 76 Intent intent = task.getTaskInfo().baseIntent; in findTask() local 77 Uri uri = intent.getData(); in findTask() 79 return intent; in findTask() 86 Intent intent = createLaunchIntent(this); in startTask() local 89 intent.setFlags(getIntent().getFlags()); in startTask() 90 if (DEBUG) Log.d(TAG, "Starting new task > " + intent.getData()); in startTask() 91 startActivity(intent); in startTask() [all …]
|
D | FilesActivity.java | 83 final Intent intent = getIntent(); in onCreate() local 84 final Uri uri = intent.getData(); in onCreate() 87 if (DEBUG) Log.d(TAG, "Stack already resolved for uri: " + intent.getData()); in onCreate() 110 } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { in onCreate() 124 final @DialogType int dialogType = intent.getIntExtra( in onCreate() 129 final int opType = intent.getIntExtra( in onCreate() 133 intent.getParcelableArrayListExtra(FileOperationService.EXTRA_SRC_LIST); in onCreate() 145 final Intent intent = getIntent(); in includeState() local 151 assert(!intent.hasExtra(Intent.EXTRA_LOCAL_ONLY)); in includeState() 153 final DocumentStack stack = intent.getParcelableExtra(Shared.EXTRA_STACK); in includeState() [all …]
|
/frameworks/base/core/tests/coretests/src/android/app/activity/ |
D | BroadcastTest.java | 109 Intent intent = new Intent(action, null); in makeBroadcastIntent() local 110 intent.putExtra("caller", mCallTarget); in makeBroadcastIntent() 111 return intent; in makeBroadcastIntent() 119 public final void gotReceive(String name, Intent intent) { in gotReceive() argument 133 if (mExpectedData[i].equals(intent.getStringExtra("test"))) { in gotReceive() 145 + intent.getStringExtra("test")); in gotReceive() 148 + intent.getStringExtra("test")); in gotReceive() 195 public void onRegisteredReceiver(Intent intent) { in onRegisteredReceiver() argument 196 gotReceive(RECEIVER_REG, intent); in onRegisteredReceiver() 226 public void onReceive(Context context, Intent intent) { [all …]
|
/frameworks/base/core/java/com/android/internal/content/ |
D | PackageMonitor.java | 179 public boolean onHandleForceStop(Intent intent, String[] packages, int uid, boolean doit) { in onHandleForceStop() argument 183 public void onHandleUserStop(Intent intent, int userHandle) { in onHandleUserStop() argument 286 String getPackageName(Intent intent) { in getPackageName() argument 287 Uri uri = intent.getData(); in getPackageName() 293 public void onReceive(Context context, Intent intent) { in onReceive() argument 294 mChangeUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, in onReceive() 297 Slog.w("PackageMonitor", "Intent broadcast does not contain user handle: " + intent); in onReceive() 305 String action = intent.getAction(); in onReceive() 307 String pkg = getPackageName(intent); in onReceive() 308 int uid = intent.getIntExtra(Intent.EXTRA_UID, 0); in onReceive() [all …]
|
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/ |
D | TestUtil.java | 52 Intent intent = new Intent(WifiManager.NETWORK_STATE_CHANGED_ACTION); in sendNetworkStateChanged() local 55 intent.putExtra(WifiManager.EXTRA_NETWORK_INFO, networkInfo); in sendNetworkStateChanged() 56 broadcastReceiver.onReceive(context, intent); in sendNetworkStateChanged() 64 Intent intent = new Intent(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); in sendScanResultsAvailable() local 65 broadcastReceiver.onReceive(context, intent); in sendScanResultsAvailable() 73 Intent intent = new Intent(WifiManager.WIFI_SCAN_AVAILABLE); in sendWifiScanAvailable() local 74 intent.putExtra(WifiManager.EXTRA_SCAN_AVAILABLE, scanAvailable); in sendWifiScanAvailable() 75 broadcastReceiver.onReceive(context, intent); in sendWifiScanAvailable() 83 Intent intent = new Intent(WifiManager.WIFI_STATE_CHANGED_ACTION); in sendWifiStateChanged() local 84 intent.putExtra(WifiManager.EXTRA_WIFI_STATE, wifiState); in sendWifiStateChanged() [all …]
|
/frameworks/base/core/java/android/content/ |
D | ContextWrapper.java | 355 public void startActivity(Intent intent) { in startActivity() argument 356 mBase.startActivity(intent); in startActivity() 361 public void startActivityAsUser(Intent intent, UserHandle user) { in startActivityAsUser() argument 362 mBase.startActivityAsUser(intent, user); in startActivityAsUser() 367 String who, Intent intent, int requestCode, Bundle options) { in startActivityForResult() argument 368 mBase.startActivityForResult(who, intent, requestCode, options); in startActivityForResult() 377 public void startActivity(Intent intent, Bundle options) { in startActivity() argument 378 mBase.startActivity(intent, options); in startActivity() 383 public void startActivityAsUser(Intent intent, Bundle options, UserHandle user) { in startActivityAsUser() argument 384 mBase.startActivityAsUser(intent, options, user); in startActivityAsUser() [all …]
|
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/services/ |
D | FileOperations.java | 111 Intent intent = new Intent(activity, FileOperationService.class); in cancel() local 112 intent.putExtra(EXTRA_CANCEL, true); in cancel() 113 intent.putExtra(EXTRA_JOB_ID, jobId); in cancel() 115 activity.startService(intent); in cancel() 124 Intent intent = createBaseIntent(OPERATION_COPY, activity, jobId, srcDocs, destination); in copy() local 129 activity.startService(intent); in copy() 149 Intent intent = createBaseIntent(OPERATION_MOVE, activity, jobId, srcDocs, srcParent, in move() local 155 activity.startService(intent); in move() 175 Intent intent = createBaseIntent(OPERATION_DELETE, activity, jobId, srcDocs, srcParent, in delete() local 177 activity.startService(intent); in delete() [all …]
|
/frameworks/base/docs/html-intl/intl/in/guide/components/ |
D | intents-filters.jd | 13 <li><a href="#ExampleExplicit">Contoh intent eksplisit</a></li> 14 <li><a href="#ExampleSend">Contoh intent implisit</a></li> 29 <li><a href="#imatch">Pencocokan intent</a></li> 48 Walaupun intent memudahkan komunikasi antarkomponen dalam beberapa cara, ada tiga 92 <p>Ada dua tipe intent:</p> 96 nama kelas yang sepenuhnya memenuhi syarat). Anda biasanya akan menggunakan intent eksplisit untuk … 103 menampilkan sebuah lokasi di peta pada pengguna, Anda bisa menggunakan intent implisit untuk memint… 107 <p>Saat Anda membuat intent eksplisit untuk memulai aktivitas atau layanan, sistem akan segera 111 <img src="{@docRoot}images/components/intent-filters@2x.png" width="446" alt="" /> 112 <p class="img-caption"><strong>Gambar 1.</strong> Ilustrasi yang menggambarkan cara intent implisit [all …]
|
/frameworks/base/packages/SettingsLib/src/com/android/settingslib/ |
D | HelpUtils.java | 101 final Intent intent = getHelpIntent(activity, helpUriString, backupContext); in prepareHelpMenuItem() local 105 if (intent != null) { in prepareHelpMenuItem() 110 activity.startActivityForResult(intent, 0); in prepareHelpMenuItem() 112 Log.e(TAG, "No activity found for intent: " + intent); in prepareHelpMenuItem() 133 Intent intent = Intent.parseUri(helpUriString, in getHelpIntent() local 135 addIntentParameters(context, intent, backupContext); in getHelpIntent() 136 ComponentName component = intent.resolveActivity(context.getPackageManager()); in getHelpIntent() 138 return intent; in getHelpIntent() 139 } else if (intent.hasExtra(EXTRA_BACKUP_URI)) { in getHelpIntent() 141 return getHelpIntent(context, intent.getStringExtra(EXTRA_BACKUP_URI), in getHelpIntent() [all …]
|
/frameworks/base/core/java/android/app/ |
D | PendingIntent.java | 198 void onSendFinished(PendingIntent pendingIntent, Intent intent, in onSendFinished() argument 226 public void performReceive(Intent intent, int resultCode, String data, in performReceive() argument 228 mIntent = intent; in performReceive() 257 void onMarshaled(PendingIntent intent, Parcel parcel, int flags); in onMarshaled() argument 301 Intent intent, @Flags int flags) { in getActivity() argument 302 return getActivity(context, requestCode, intent, flags, null); in getActivity() 334 @NonNull Intent intent, @Flags int flags, @Nullable Bundle options) { in getActivity() argument 336 String resolvedType = intent != null ? intent.resolveTypeIfNeeded( in getActivity() 339 intent.migrateExtraStreamToClipData(); in getActivity() 340 intent.prepareToLeaveProcess(context); in getActivity() [all …]
|
D | Instrumentation.java | 387 public Activity startActivitySync(Intent intent) { in startActivitySync() argument 391 intent = new Intent(intent); in startActivitySync() 393 ActivityInfo ai = intent.resolveActivityInfo( in startActivitySync() 396 throw new RuntimeException("Unable to resolve activity for: " + intent); in startActivitySync() 404 + ai.processName + ": " + intent); in startActivitySync() 407 intent.setComponent(new ComponentName( in startActivitySync() 409 final ActivityWaiter aw = new ActivityWaiter(intent); in startActivitySync() 416 getTargetContext().startActivity(intent); in startActivitySync() 583 Intent intent) { in match() argument 586 && mWhich.match(who.getContentResolver(), intent, in match() [all …]
|
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/ |
D | DpmMockContext.java | 446 public void sendBroadcast(Intent intent) { in sendBroadcast() argument 447 spiedContext.sendBroadcast(intent); in sendBroadcast() 451 public void sendBroadcast(Intent intent, String receiverPermission) { in sendBroadcast() argument 452 spiedContext.sendBroadcast(intent, receiverPermission); in sendBroadcast() 456 public void sendBroadcastMultiplePermissions(Intent intent, String[] receiverPermissions) { in sendBroadcastMultiplePermissions() argument 457 spiedContext.sendBroadcastMultiplePermissions(intent, receiverPermissions); in sendBroadcastMultiplePermissions() 461 public void sendBroadcast(Intent intent, String receiverPermission, Bundle options) { in sendBroadcast() argument 462 spiedContext.sendBroadcast(intent, receiverPermission, options); in sendBroadcast() 466 public void sendBroadcast(Intent intent, String receiverPermission, int appOp) { in sendBroadcast() argument 467 spiedContext.sendBroadcast(intent, receiverPermission, appOp); in sendBroadcast() [all …]
|
/frameworks/support/v4/java/android/support/v4/app/ |
D | RemoteInput.java | 187 public static Bundle getResultsFromIntent(Intent intent) { in getResultsFromIntent() argument 188 return IMPL.getResultsFromIntent(intent); in getResultsFromIntent() 202 public static void addResultsToIntent(RemoteInput[] remoteInputs, Intent intent, in addResultsToIntent() argument 204 IMPL.addResultsToIntent(remoteInputs, intent, results); in addResultsToIntent() 210 Bundle getResultsFromIntent(Intent intent); in getResultsFromIntent() argument 211 void addResultsToIntent(RemoteInput[] remoteInputs, Intent intent, in addResultsToIntent() argument 217 public Bundle getResultsFromIntent(Intent intent) { in getResultsFromIntent() argument 223 public void addResultsToIntent(RemoteInput[] remoteInputs, Intent intent, Bundle results) { in addResultsToIntent() argument 230 public Bundle getResultsFromIntent(Intent intent) { in getResultsFromIntent() argument 231 return RemoteInputCompatJellybean.getResultsFromIntent(intent); in getResultsFromIntent() [all …]
|
/frameworks/support/v17/tests/src/android/support/v17/leanback/app/ |
D | BrowseFragmentTest.java | 84 private void initActivity(Intent intent) { in initActivity() argument 85 setActivityIntent(intent); in initActivity() 88 Thread.sleep(intent.getLongExtra(BrowseFragmentTestActivity.EXTRA_LOAD_DATA_DELAY, in initActivity() 96 Intent intent = new Intent(mInstrumentation.getContext(), BrowseFragmentTestActivity.class); in testTwoBackKeysWithBackStack() local 97 intent.putExtra(BrowseFragmentTestActivity.EXTRA_LOAD_DATA_DELAY, (long) 1000); in testTwoBackKeysWithBackStack() 98 intent.putExtra(BrowseFragmentTestActivity.EXTRA_ADD_TO_BACKSTACK , true); in testTwoBackKeysWithBackStack() 99 initActivity(intent); in testTwoBackKeysWithBackStack() 109 Intent intent = new Intent(mInstrumentation.getContext(), BrowseFragmentTestActivity.class); in testTwoBackKeysWithoutBackStack() local 110 intent.putExtra(BrowseFragmentTestActivity.EXTRA_LOAD_DATA_DELAY, (long) 1000); in testTwoBackKeysWithoutBackStack() 111 intent.putExtra(BrowseFragmentTestActivity.EXTRA_ADD_TO_BACKSTACK , false); in testTwoBackKeysWithoutBackStack() [all …]
|
D | BrowseSupportFragmentTest.java | 86 private void initActivity(Intent intent) { in initActivity() argument 87 setActivityIntent(intent); in initActivity() 90 Thread.sleep(intent.getLongExtra(BrowseSupportFragmentTestActivity.EXTRA_LOAD_DATA_DELAY, in initActivity() 98 …Intent intent = new Intent(mInstrumentation.getContext(), BrowseSupportFragmentTestActivity.class); in testTwoBackKeysWithBackStack() local 99 intent.putExtra(BrowseSupportFragmentTestActivity.EXTRA_LOAD_DATA_DELAY, (long) 1000); in testTwoBackKeysWithBackStack() 100 intent.putExtra(BrowseSupportFragmentTestActivity.EXTRA_ADD_TO_BACKSTACK , true); in testTwoBackKeysWithBackStack() 101 initActivity(intent); in testTwoBackKeysWithBackStack() 111 …Intent intent = new Intent(mInstrumentation.getContext(), BrowseSupportFragmentTestActivity.class); in testTwoBackKeysWithoutBackStack() local 112 intent.putExtra(BrowseSupportFragmentTestActivity.EXTRA_LOAD_DATA_DELAY, (long) 1000); in testTwoBackKeysWithoutBackStack() 113 intent.putExtra(BrowseSupportFragmentTestActivity.EXTRA_ADD_TO_BACKSTACK , false); in testTwoBackKeysWithoutBackStack() [all …]
|
/frameworks/base/docs/html-intl/intl/zh-cn/training/monitoring-device-state/ |
D | battery-monitoring.jd | 24 <li><a href="{@docRoot}guide/components/intents-filters.html">intent 和 intent 过滤器</a> 41 …这是个持续 intent,因此您无需通过将传入 {@code null} 的 {@code registerReceiver} 作为接收器直接调用(如下一代码段所示)来注册 {@link andr… 65 …r} 就会广播相应的操作。即使您的应用没有运行,也请务必接收这些事件,尤其是当这些事件会影响您启动应用以执行后台更新的频率时。因此,您应该通过在 intent 过滤器中定义 {@link andr… 68 <intent-filter> 69 <action android:name="android.intent.action.ACTION_POWER_CONNECTED"/> 70 <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/> 71 </intent-filter> 78 public void onReceive(Context context, Intent intent) { 79 int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1); 83 int chargePlug = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); [all …]
|