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


Java SendIntentException類代碼示例

本文整理匯總了Java中android.content.IntentSender.SendIntentException的典型用法代碼示例。如果您正苦於以下問題:Java SendIntentException類的具體用法?Java SendIntentException怎麽用?Java SendIntentException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SendIntentException類屬於android.content.IntentSender包,在下文中一共展示了SendIntentException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleSignInResult

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
private void handleSignInResult(GoogleSignInResult m_result) {
	if (m_result.isSuccess()) {
		mAccount = m_result.getSignInAccount();
		succeedSignIn();
	} else {
		Status s = m_result.getStatus();

		Log.w(TAG, "SignInResult::Failed code="
		+ s.getStatusCode() + ", Message: " + s.getStatusMessage());

		if (isResolvingConnectionFailure) { return; }
		if (!isIntentInProgress && m_result.getStatus().hasResolution()) {
			try {
				isIntentInProgress = true;

				activity.startIntentSenderForResult(
				s.getResolution().getIntentSender(),
				GOOGLE_SIGN_IN_REQUEST, null, 0, 0, 0);
			} catch (SendIntentException ex) {
				connect();
			}

			isResolvingConnectionFailure = true;
		}
	}
}
 
開發者ID:FrogSquare,項目名稱:GodotGoogleService,代碼行數:27,代碼來源:PlayService.java

示例2: onConnectionFailed

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
@Override
public void onConnectionFailed(@NonNull ConnectionResult m_result) {
	Utils.d("Google:Connection:Failed");

	if (isResolvingConnectionFailure) { return; }
	if(!isIntentInProgress && m_result.hasResolution()) {
		try {
			isIntentInProgress = true;

			activity.startIntentSenderForResult(
			m_result.getResolution().getIntentSender(),
			Utils.FIREBASE_GOOGLE_SIGN_IN, null, 0, 0, 0);

		} catch (SendIntentException ex) {
			isIntentInProgress = false;
			signIn();
		}

		isResolvingConnectionFailure = true;
		Utils.d("Google:Connection:Resolving.");
               }
}
 
開發者ID:FrogSquare,項目名稱:GodotFireBase,代碼行數:23,代碼來源:GoogleSignIn.java

示例3: resolveConnectionFailure

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
public boolean resolveConnectionFailure(ConnectionResult result, int requestCode) {
    if (result.hasResolution()) {
        try {
            result.startResolutionForResult(activity, requestCode);
            return true;
        } catch (IntentSender.SendIntentException e) {
            // The intent was canceled before it was sent.  Return to the default
            // state and attempt to connect to get an updated ConnectionResult.
            googleApiClient.connect();
            return false;
        }
    } else {
        // not resolvable... so show an error message
        int errorCode = result.getErrorCode();

        if (errorCode == ConnectionResult.INTERNAL_ERROR) {
            googleApiClient.connect();
        }

        GodotLib.calldeferred(instance_id, "_on_google_play_game_services_connection_failed", new Object[] { });
        Log.i(TAG, "GPGS: onConnectionFailed error code: " + String.valueOf(errorCode));
        return false;
    }
}
 
開發者ID:kloder-games,項目名稱:godot-gpgs,代碼行數:25,代碼來源:Client.java

示例4: run

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
public final void run()
{
  if (this.b.a()) {
    try
    {
      int i = 1 + (1 + this.c.f().b.a.d.f().indexOf(this.c) << 16);
      this.b.a(this.c.f(), i);
      return;
    }
    catch (IntentSender.SendIntentException localSendIntentException)
    {
      ehe.a(this.c);
      return;
    }
  }
  if (eer.b(this.b.c))
  {
    eer.a(this.b.c, this.c.f(), this.c, 2, this.c);
    return;
  }
  ehe.a(this.c, this.a, this.b);
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:23,代碼來源:ehh.java

示例5: onConnectionFailed

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
@Override
public void onConnectionFailed(ConnectionResult result) {
    if (commonProgressDialog.isShowing()) {
        // The user clicked the sign-in button already. Start to resolve
        // connection errors. Wait until onConnected() to dismiss the
        // connection dialog.
        if (result.hasResolution()) {
            try {
                result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
            } catch (SendIntentException e) {
                Log.e(TAG, e.getMessage(), e);
                // Yeah, no idea what to do here.
                commonProgressDialog.dismiss();
                Toast.makeText(LoginActivity.this, R.string.google_app_login_failed, Toast.LENGTH_SHORT).show();
            }
        } else {
            commonProgressDialog.dismiss();
            if (!isNetworkAvailable()) {
                Toast.makeText(LoginActivity.this, R.string.toast_no_internet_connection, Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(LoginActivity.this, R.string.google_app_login_failed, Toast.LENGTH_SHORT).show();
            }

        }
    }
}
 
開發者ID:zulip,項目名稱:zulip-android,代碼行數:27,代碼來源:LoginActivity.java

示例6: startResolution

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
/**
 * A helper method to flip the mResolveOnFail flag and start the resolution
 * of the ConnenctionResult from the failed connect() call.
 */
private void startResolution() {

    try {
        // Don't start another resolution now until we have a
        // result from the activity we're about to start.
        mResolveOnFail = false;
        // If we can resolve the error, then call start resolution
        // and pass it an integer tag we can use to track. This means
        // that when we get the onActivityResult callback we'll know
        // its from being started here.
        mConnectionResult
                        .startResolutionForResult(mActivity, CONNECTION_UPDATE_ERROR);
    } catch (final SendIntentException e) {
        // Any problems, just try to connect() again so we get a new
        // ConnectionResult.
        mPlusClient.connect();
    }
}
 
開發者ID:yeloapp,項目名稱:yelo-android,代碼行數:23,代碼來源:GooglePlusManager.java

示例7: purchaseIntent

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
public void purchaseIntent(String sku, int REQUEST_CODE) {
    if (mService == null) return;
    try {
        String developerPayload = "abcdefghijklmnopqrstuvwxyz";
        Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(),
                sku, "inapp",developerPayload);
        PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
        startIntentSenderForResult(pendingIntent.getIntentSender(),
                REQUEST_CODE, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
                Integer.valueOf(0));
    } catch (RemoteException e1) {
        return;
    } catch (SendIntentException e2) {
        return;
    }
}
 
開發者ID:firebirdberlin,項目名稱:tinytimetracker,代碼行數:17,代碼來源:TinyTimeTracker.java

示例8: showCancelableIntent

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
@Override
public int showCancelableIntent(
        PendingIntent intent, IntentCallback callback, Integer errorId) {
    Activity activity = getActivity().get();
    if (activity == null) return START_INTENT_FAILURE;

    int requestCode = generateNextRequestCode();

    try {
        activity.startIntentSenderForResult(
                intent.getIntentSender(), requestCode, new Intent(), 0, 0, 0);
    } catch (SendIntentException e) {
        return START_INTENT_FAILURE;
    }

    storeCallbackData(requestCode, callback, errorId);
    return requestCode;
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:19,代碼來源:ActivityWindowAndroid.java

示例9: onConnectionFailed

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
@Override
public void onConnectionFailed(ConnectionResult result) {
	if (!mIntentInProgress && result.hasResolution()) {
		try {
			mIntentInProgress = true;
			startIntentSenderForResult(result.getResolution()
					.getIntentSender(), RC_SIGN_IN, null, 0, 0, 0);
		} catch (SendIntentException e) {
			// The intent was canceled before it was sent. Return to the
			// default
			// state and attempt to connect to get an updated
			// ConnectionResult.
			mIntentInProgress = false;
			mGoogleApiClient.connect();
		}
	}
}
 
開發者ID:Ocelotworks,項目名稱:Weedsim,代碼行數:18,代碼來源:StartActivity.java

示例10: onResult

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
@Override
public void onResult(LocationSettingsResult locationSettingsResult) {
    final Status status = locationSettingsResult.getStatus();
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            Log.i(TAG, "All location settings are satisfied.");
            GetLastLocation();
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            Log.i(TAG, "Location settings are not satisfied. Show the user a dialog to" +
                    "upgrade location settings ");

            try {
                // Show the dialog by calling startResolutionForResult(), and check the result
                // in onActivityResult().
                status.startResolutionForResult(mActivity, REQUEST_CHECK_SETTINGS);
            } catch (IntentSender.SendIntentException e) {                   
                ErrorHappened("PendingIntent unable to execute request.");
            }
            break;
        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:              
            ErrorHappened("Location settings are inadequate, and cannot be fixed here. Dialog " +
                    "not created.");
            break;
    }
}
 
開發者ID:snokleby,項目名稱:cordova-fusedlocation,代碼行數:27,代碼來源:FusedLocationHelper.java

示例11: resolveSignInError

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
private void resolveSignInError() {
	if (connectionResult.hasResolution()) {
		try {
			intentInProgress = true;
			startIntentSenderForResult(connectionResult.getResolution()
					.getIntentSender(), RC_SIGN_IN, null, 0, 0, 0);
		} catch (SendIntentException e) {
			Log.i(LOG_TAG,
					"Sign in intent could not be sent: "
							+ e.getLocalizedMessage());
			// The intent was canceled before it was sent. Return to the
			// default
			// state and attempt to connect to get an updated
			// ConnectionResult.
			intentInProgress = false;
			googleAPIClient.connect();
		}
	}
}
 
開發者ID:jinman,項目名稱:snake-game-aws,代碼行數:20,代碼來源:LoginActivity.java

示例12: onConnectionFailed

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
public void onConnectionFailed(ConnectionResult paramConnectionResult)
{
  if (paramConnectionResult.hasResolution())
    try
    {
      ˎ localˎ = getActivity();
      getActivity();
      paramConnectionResult.startResolutionForResult(localˎ, 9000);
      return;
    }
    catch (IntentSender.SendIntentException localSendIntentException)
    {
      this.mGoogleApiClient.connect();
      localSendIntentException.printStackTrace();
    }
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:17,代碼來源:SettingsFragment.java

示例13: onConnectionFailed

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
public void onConnectionFailed(ConnectionResult paramConnectionResult)
{
  if (this.activity == null)
    return;
  if (paramConnectionResult.hasResolution())
    try
    {
      paramConnectionResult.startResolutionForResult(this.activity, 9000);
      return;
    }
    catch (IntentSender.SendIntentException localSendIntentException)
    {
      localSendIntentException.printStackTrace();
      return;
    }
  paramConnectionResult.getErrorCode();
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:18,代碼來源:HomeActivityLocationHelper.java

示例14: onConnectionFailed

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
@Override
public void onConnectionFailed(ConnectionResult result) {
	if (mResolvingError) {
           // Already attempting to resolve an error.
           return;
       } else if (result.hasResolution()) {
           try {
               mResolvingError = true;
               result.startResolutionForResult(this, REQUEST_RESOLVE_ERROR);
           } catch (SendIntentException e) {
               // There was an error with the resolution intent. Try again.
               mGoogleApiClient.connect();
           }
       } else {
           // Show dialog using GooglePlayServicesUtil.getErrorDialog()
           showErrorDialog(result.getErrorCode());
           mResolvingError = true;
       }
	
}
 
開發者ID:CODA-Masters,項目名稱:Little-Nibolas,代碼行數:21,代碼來源:AndroidLauncher.java

示例15: onConnected

import android.content.IntentSender.SendIntentException; //導入依賴的package包/類
@Override
public void onConnected(Bundle connectionHint) {
    super.onConnected(connectionHint);

    // If there is a selected file, open its contents.
    if (mSelectedFileDriveId != null) {
        open();
        return;
    }

    // Let the user pick an mp4 or a jpeg file if there are
    // no files selected by the user.
    IntentSender intentSender = Drive.DriveApi
            .newOpenFileActivityBuilder()
            .setMimeType(new String[]{ "video/mp4", "image/jpeg" })
            .build(getGoogleApiClient());
    try {
        startIntentSenderForResult(intentSender, REQUEST_CODE_OPENER, null, 0, 0, 0);
    } catch (SendIntentException e) {
      Log.w(TAG, "Unable to send intent", e);
    }
}
 
開發者ID:TerribleDev,項目名稱:XamarinAdmobTutorial,代碼行數:23,代碼來源:RetrieveContentsWithProgressDialogActivity.java


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