Android - 从服务调用startIntentSenderForResult

时间:2014-12-10 12:52:08

标签: android authentication mobile google-plus intentservice

我创建了一个处理Google+登录的Auth IntentService,如果connectionResult有解决方案,我想提示用户登录。

//...
@Override
protected void onHandleIntent(final Intent intent) {
    if (intent.getAction().equals(ACTION_AUTH)) {
        doAuth(new AuthCallback() {
            @Override
            public void authed(String token) {
                Intent intent = new Intent(ACTION_AUTHED);
                intent.putExtra("token", token);
                localBroadcastManager.sendBroadcast(intent);
            }
        });
    }
}

protected void doAuth(AuthCallback callback) {
    Log.d("GoogleAuthIntentService", "Google Auth");

    //doing login, getting token
    mConnectionResult = mGoogleApiClient.blockingConnect();
    if (mConnectionResult.isSuccess()) {
        //return the user data (not yet implemented)
        callback.authed("USER DATA");
    } else if (mConnectionResult.hasResolution()) {
        // prompt to sign in
        // How can I call startIntentSenderForResult ???
    }

}

当我到达我要解决登录的位置时,我没有startIntentSenderForResult方法。

保持服务中的逻辑符号的正确方法是什么?

0 个答案:

没有答案