本文整理汇总了Java中android.content.IntentSender.SendIntentException方法的典型用法代码示例。如果您正苦于以下问题:Java IntentSender.SendIntentException方法的具体用法?Java IntentSender.SendIntentException怎么用?Java IntentSender.SendIntentException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.IntentSender
的用法示例。
在下文中一共展示了IntentSender.SendIntentException方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConnectionFailed
import android.content.IntentSender; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
DebugLog.logMethod();
DebugLog.logMessage("ConnectionResult: " + connectionResult.toString());
DebugLog.logMessage("ConnectionResult error: " + connectionResult.getErrorCode() + "\n" + connectionResult.getErrorMessage());
if (!connectionResult.hasResolution()) {
GoogleApiAvailability.getInstance()
.getErrorDialog(getActivity(), connectionResult.getErrorCode(), 0)
.show();
return;
}
try {
connectionResult.startResolutionForResult(getActivity(), Constants.CONNECTION_RESOLUTION_REQUEST_CODE);
connectionFailed = true;
} catch (IntentSender.SendIntentException e) {
// Unable to resolve, message user appropriately
e.printStackTrace();
DebugLog.logMessage(e.getMessage());
Utilities.showToast(getActivity(), getString(R.string.google_drive_no_resolution));
}
}
示例2: onConnectionFailed
import android.content.IntentSender; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.i(TAG, "onConnectionFailed:" + connectionResult.getErrorMessage());
// Viene chiamata nel caso la connect fallisca ad esempio
// non è ancora stata data autorizzaiozne alla applicazione corrente
if (connectionResult.hasResolution()) {
try {
connectionResult.startResolutionForResult(this, RESOLVE_CONNECTION_REQUEST_CODE);
} catch (IntentSender.SendIntentException e) {
// Unable to resolve, message user appropriately
}
} else {
GoogleApiAvailability.getInstance().getErrorDialog(this, connectionResult.getErrorCode(), 0).show();
}
}
示例3: startIntentSenderFromChild
import android.content.IntentSender; //导入方法依赖的package包/类
/**
* Like {@link #startActivityFromChild(Activity, Intent, int)}, but
* taking a IntentSender; see
* {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int, int)}
* for more information.
*/
public void startIntentSenderFromChild(Activity child, IntentSender intent,
int requestCode, Intent fillInIntent, int flagsMask, int flagsValues,
int extraFlags, @Nullable Bundle options)
throws IntentSender.SendIntentException {
startIntentSenderForResultInner(intent, child.mEmbeddedID, requestCode, fillInIntent,
flagsMask, flagsValues, options);
}
示例4: launchPendingIntent
import android.content.IntentSender; //导入方法依赖的package包/类
private void launchPendingIntent(CryptoResultAnnotation cryptoResultAnnotation) {
try {
PendingIntent pendingIntent = cryptoResultAnnotation.getOpenPgpPendingIntent();
if (pendingIntent != null) {
messageSecurityMvpView.startPendingIntentForCryptoPresenter(
pendingIntent.getIntentSender(), REQUEST_CODE_UNKNOWN_KEY, null, 0, 0, 0);
}
} catch (IntentSender.SendIntentException e) {
Timber.e(e, "SendIntentException");
}
}
示例5: onClickShowCryptoWarningDetails
import android.content.IntentSender; //导入方法依赖的package包/类
public void onClickShowCryptoWarningDetails() {
try {
PendingIntent pendingIntent = cryptoResultAnnotation.getOpenPgpInsecureWarningPendingIntent();
if (pendingIntent != null) {
messageSecurityMvpView.startPendingIntentForCryptoPresenter(
pendingIntent.getIntentSender(), REQUEST_CODE_SECURITY_WARNING, null, 0, 0, 0);
}
} catch (IntentSender.SendIntentException e) {
Timber.e(e, "SendIntentException");
}
}
示例6: donatePlay
import android.content.IntentSender; //导入方法依赖的package包/类
public void donatePlay(IntentSender sender) {
try {
startIntentSenderForResult(sender, REQUEST_PLAY_DONATE, new Intent(), 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
Log.d(getTag(), "Can't donate");
}
}
示例7: getLocationSettingsResultCallback
import android.content.IntentSender; //导入方法依赖的package包/类
@NonNull
private ResultCallback<Result> getLocationSettingsResultCallback() {
return new ResultCallback<Result>() {
@Override
public void onResult(@NonNull Result result) {
Status status = result.getStatus();
if (status.getStatusCode() == CommonStatusCodes.SUCCESS) {
Log.i(TAG, "All location settings are satisfied.");
Runnable requestUpdatesTask = new OnPermissionsTask();
if (isConnected()) requestUpdatesTask.run();
else {
mOnConnectedUpdateCallback = requestUpdatesTask;
Log.d(TAG, "Google API is not connected. "
+ "Updates delayed until Google API is connected again.");
}
} else if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) {
Log.i(TAG, "Location settings are not satisfied. "
+ "Showing the user a dialog to upgrade location settings.");
try {
setRequestingPermissions(true);
// Show the dialog by calling startResolutionForResult(),
// and check the result in the onActivityResult() of mContext
status.startResolutionForResult(mContext, REQUEST_CHECK_SETTINGS);
} catch (IntentSender.SendIntentException e) {
Log.wtf(TAG, "PendingIntent unable to execute request", e);
}
} else if (status.getStatusCode()
== LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE) {
if (checkNetwork()) {
Log.w(TAG, "Location settings can't be changed to meet the requirements");
setHasPermissions(false);
mOnPermissionsChangedListeners.run();
setRequestingPermissions(false);
}
}
}
};
}
示例8: handleIntent
import android.content.IntentSender; //导入方法依赖的package包/类
void handleIntent() {
Status status = getIntent().getParcelableExtra(ARG_STATUS);
try {
status.startResolutionForResult(this, REQUEST_CODE_RESOLUTION);
} catch (IntentSender.SendIntentException | NullPointerException e) {
setResolutionResultAndFinish(Activity.RESULT_CANCELED);
}
}
示例9: onStartIntentSenderFromFragment
import android.content.IntentSender; //导入方法依赖的package包/类
@Override
public void onStartIntentSenderFromFragment(Fragment fragment, IntentSender intent,
int requestCode, @Nullable Intent fillInIntent, int flagsMask, int flagsValues,
int extraFlags, Bundle options) throws IntentSender.SendIntentException {
if (mParent == null) {
startIntentSenderForResultInner(intent, fragment.mWho, requestCode, fillInIntent,
flagsMask, flagsValues, options);
} else if (options != null) {
mParent.startIntentSenderFromChildFragment(fragment, intent, requestCode,
fillInIntent, flagsMask, flagsValues, extraFlags, options);
}
}
示例10: resolveSignInConnectionResult
import android.content.IntentSender; //导入方法依赖的package包/类
/**
*
*
* Private API
*
*
*/
private void resolveSignInConnectionResult( @NonNull ConnectionResult connectionResult ) {
AIR.log( "GameServicesHelper::resolveSignInConnectionResult ErrorCode:" + connectionResult.getErrorCode() );
mUserAuth = false;
mPendingConnectionResult = null;
try {
connectionResult.startResolutionForResult( AIR.getContext().getActivity(), AUTH_RESULT_CODE );
AIR.dispatchEvent( GameServicesEvent.WILL_PRESENT_AUTH_DIALOG );
} catch( IntentSender.SendIntentException e ) {
e.printStackTrace();
mGoogleApiClient.connect();
}
}
示例11: resolveConnectionFailure
import android.content.IntentSender; //导入方法依赖的package包/类
/**
* Resolve a connection failure from
* {@link com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener#onConnectionFailed(com.google.android.gms.common.ConnectionResult)}
*
* @param activity the Activity trying to resolve the connection failure.
* @param client the GoogleAPIClient instance of the Activity.
* @param result the ConnectionResult received by the Activity.
* @param requestCode a request code which the calling Activity can use to identify the result
* of this resolution in onActivityResult.
* @param fallbackErrorMessage a generic error message to display if the failure cannot be resolved.
* @return true if the connection failure is resolved, false otherwise.
*/
public static boolean resolveConnectionFailure(Activity activity,
GoogleApiClient client, ConnectionResult result, int requestCode,
int fallbackErrorMessage) {
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.
client.connect();
return false;
}
} else {
// not resolvable... so show an error message
int errorCode = result.getErrorCode();
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
activity, requestCode);
if (dialog != null) {
dialog.show();
} else {
// no built-in dialog: show the fallback error message
showAlert(activity, activity.getString(fallbackErrorMessage));
}
return false;
}
}
示例12: startIntentSenderForResult
import android.content.IntentSender; //导入方法依赖的package包/类
/**
* Same as calling {@link #startIntentSenderForResult(IntentSender, int,
* Intent, int, int, int, Bundle)} with no options.
*
* @param intent The IntentSender to launch.
* @param requestCode If >= 0, this code will be returned in
* onActivityResult() when the activity exits.
* @param fillInIntent If non-null, this will be provided as the
* intent parameter to {@link IntentSender#sendIntent}.
* @param flagsMask Intent flags in the original IntentSender that you
* would like to change.
* @param flagsValues Desired values for any bits set in
* <var>flagsMask</var>
* @param extraFlags Always set to 0.
*/
public void startIntentSenderForResult(IntentSender intent, int requestCode,
@Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
throws IntentSender.SendIntentException {
startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask,
flagsValues, extraFlags, null);
}
示例13: startIntentSender
import android.content.IntentSender; //导入方法依赖的package包/类
/**
* Same as calling {@link #startIntentSender(IntentSender, Intent, int, int, int, Bundle)}
* with no options.
*
* @param intent The IntentSender to launch.
* @param fillInIntent If non-null, this will be provided as the
* intent parameter to {@link IntentSender#sendIntent}.
* @param flagsMask Intent flags in the original IntentSender that you
* would like to change.
* @param flagsValues Desired values for any bits set in
* <var>flagsMask</var>
* @param extraFlags Always set to 0.
*/
public void startIntentSender(IntentSender intent,
@Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
throws IntentSender.SendIntentException {
startIntentSender(intent, fillInIntent, flagsMask, flagsValues,
extraFlags, null);
}