当前位置: 首页>>代码示例>>Java>>正文


Java UserRecoverableNotifiedException类代码示例

本文整理汇总了Java中com.google.android.gms.auth.UserRecoverableNotifiedException的典型用法代码示例。如果您正苦于以下问题:Java UserRecoverableNotifiedException类的具体用法?Java UserRecoverableNotifiedException怎么用?Java UserRecoverableNotifiedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UserRecoverableNotifiedException类属于com.google.android.gms.auth包,在下文中一共展示了UserRecoverableNotifiedException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGoogleAuthToken

import com.google.android.gms.auth.UserRecoverableNotifiedException; //导入依赖的package包/类
private String getGoogleAuthToken() throws IOException {
	String googleUserName = PrefsUtil.retrieveGoogleTasksUser(mContext);
	
	String token = "";
	try {
		Log.d(TAG, "getGoogleAuthToken... "+googleUserName);
		token = GoogleAuthUtil.getTokenWithNotification(mContext,
				googleUserName, GoogleTaskApiService.SCOPE, null);
	} catch (UserRecoverableNotifiedException userNotifiedException) {
		// Notification has already been pushed.
		// Continue without token or stop background task.
	} catch (GoogleAuthException authEx) {
		// This is likely unrecoverable.
		Log.e(TAG,
				"Unrecoverable authentication exception: "
						+ authEx.getMessage(), authEx);
	}
	return token;
}
 
开发者ID:sschendel,项目名称:SyncManagerAndroid-DemoGoogleTasks,代码行数:20,代码来源:TaskSyncAdapter.java

示例2: fetchToken

import com.google.android.gms.auth.UserRecoverableNotifiedException; //导入依赖的package包/类
/**
 * Get a authentication token if one is not available. If the error was recoverable then a
 * notification will automatically be pushed. The callback provided will be fired once the
 * notification is addressed by the user successfully. If the error is not recoverable then
 * it displays the error message on parent activity.
 */
@Override
protected String fetchToken() throws IOException {
    try {
        return GoogleAuthUtil.getTokenWithNotification(
                mActivity, mEmail, mScope, null, makeCallback(mEmail));
    } catch (UserRecoverableNotifiedException userRecoverableException) {
        // Unable to authenticate, but the user can fix this.
        // Because we've used getTokenWithNotification(), a Notification is
        // created automatically so the user can recover from the error
        onError("Could not fetch token.", null);
    } catch (GoogleAuthException fatalException) {
        onError("Unrecoverable error " + fatalException.getMessage(), fatalException);
    }
    return null;
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:22,代码来源:GetNameInBackground.java

示例3: fetchToken

import com.google.android.gms.auth.UserRecoverableNotifiedException; //导入依赖的package包/类
@Override
protected String fetchToken() throws IOException {
    try {
        return GoogleAuthUtil.getTokenWithNotification(
                mActivity, mEmail, mScope, null, CONTACTS_AUTHORITY, null);
    } catch (UserRecoverableNotifiedException userRecoverableException) {
        // Unable to authenticate, but the user can fix this.
        // Because we've used getTokenWithNotification(), a Notification is
        // created automatically so the user can recover from the error
        onError("Could not fetch token.", null);
    } catch (GoogleAuthException fatalException) {
        onError("Unrecoverable error " + fatalException.getMessage(), fatalException);
    }
    return null;
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:16,代码来源:GetNameInBackgroundWithSync.java

示例4: doAuth

import com.google.android.gms.auth.UserRecoverableNotifiedException; //导入依赖的package包/类
public void doAuth () throws OperationCanceledException, AuthenticatorException, IOException, UserRecoverableNotifiedException, GoogleAuthException
{
	
	Bundle bund = new Bundle();
	token = GoogleAuthUtil.getTokenWithNotification(InformaService.getInstance().getApplicationContext(), account.name, Models.ITransportStub.GoogleDrive.SCOPE,bund);
	
	if (bund.containsKey(AccountManager.KEY_AUTHTOKEN))	
		token = bund.getString(AccountManager.KEY_AUTHTOKEN);

	/**
	if (token != null)
		am.invalidateAuthToken(Models.ITransportStub.GoogleDrive.SCOPE, token);

	
	AccountManagerFuture<Bundle> response = am.getAuthToken(account, Models.ITransportStub.GoogleDrive.SCOPE, true, new AccountManagerCallback<Bundle> () {

		@Override
		public void run(AccountManagerFuture<Bundle> result) {
            try {
				token = result.getResult().getString(AccountManager.KEY_AUTHTOKEN);
            	
			} catch (OperationCanceledException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (AuthenticatorException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		
		
	}, null);
	
	Bundle b;
	b = response.getResult();
	token = b.getString(AccountManager.KEY_AUTHTOKEN);
		
				*/
	
}
 
开发者ID:guardianproject,项目名称:CameraV,代码行数:45,代码来源:GoogleDriveTransport.java


注:本文中的com.google.android.gms.auth.UserRecoverableNotifiedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。