本文整理汇总了Java中android.accounts.AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION属性的典型用法代码示例。如果您正苦于以下问题:Java AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION属性的具体用法?Java AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION怎么用?Java AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.accounts.AccountManager
的用法示例。
在下文中一共展示了AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetTokenCallbackWithIntent
/**
* Tests the behavior of {@link HttpNegotiateAuthenticator.GetTokenCallback} when the result it
* receives contains an intent rather than a token directly.
*/
@Test
public void testGetTokenCallbackWithIntent() {
String type = "Dummy_Account";
HttpNegotiateAuthenticator authenticator = createWithoutNative(type);
RequestData requestData = new RequestData();
requestData.nativeResultObject = 42;
requestData.authTokenType = "foo";
requestData.account = new Account("a", type);
requestData.accountManager = sMockAccountManager;
Bundle b = new Bundle();
b.putParcelable(AccountManager.KEY_INTENT, new Intent());
authenticator.new GetTokenCallback(requestData).run(makeFuture(b));
verifyZeroInteractions(sMockAccountManager);
// Verify that the broadcast receiver is registered
Intent intent = new Intent(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION);
ShadowApplication shadowApplication = Robolectric.getShadowApplication();
List<BroadcastReceiver> receivers = shadowApplication.getReceiversForIntent(intent);
assertThat("There is one registered broadcast receiver", receivers.size(), equalTo(1));
// Send the intent to the receiver.
BroadcastReceiver receiver = receivers.get(0);
receiver.onReceive(Robolectric.getShadowApplication().getApplicationContext(), intent);
// Verify that the auth token is properly requested from the account manager.
verify(sMockAccountManager).getAuthToken(
eq(new Account("a", type)),
eq("foo"),
isNull(Bundle.class),
eq(true),
any(HttpNegotiateAuthenticator.GetTokenCallback.class),
any(Handler.class));
}
示例2: sendAccountsChangedBroadcast
private void sendAccountsChangedBroadcast(int userId) {
Intent intent = new Intent(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION);
VActivityManagerService.get().sendBroadcastAsUser(intent, new VUserHandle(userId));
broadcastCheckInNowIfNeed(userId);
}
示例3: sendAccountsChangedBroadcast
private void sendAccountsChangedBroadcast(int userId) {
Intent intent = new Intent(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION);
VActivityManagerService.get().sendBroadcastAsUser(intent, new VUserHandle(userId));
broadcastCheckInNowIfNeed(userId);
}
示例4: sendAccountsChangedBroadcast
private void sendAccountsChangedBroadcast(int userId) {
Intent intent = new Intent(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION);
VActivityManager.get().sendBroadcast(intent, userId);
broadcastCheckInNow(userId);
}