本文整理汇总了C#中ConnectionResult.StartResolutionForResult方法的典型用法代码示例。如果您正苦于以下问题:C# ConnectionResult.StartResolutionForResult方法的具体用法?C# ConnectionResult.StartResolutionForResult怎么用?C# ConnectionResult.StartResolutionForResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionResult
的用法示例。
在下文中一共展示了ConnectionResult.StartResolutionForResult方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnConnectionFailed
public void OnConnectionFailed (ConnectionResult result)
{
Log.Debug (TAG, "onConnectionFailed:" + result);
if (!mIsResolving && mShouldResolve)
{
if (result.HasResolution)
{
try
{
result.StartResolutionForResult (Activity, RC_SIGN_IN);
mIsResolving = true;
}
catch (IntentSender.SendIntentException e)
{
Log.Error (TAG, "Could not resolve ConnectionResult.", e);
mIsResolving = false;
mGoogleApiClient.Connect ();
}
}
else {
ShowErrorDialog (result);
}
}
else {
UpdateUI (false);
}
}
示例2: OnConnectionFailed
public void OnConnectionFailed(ConnectionResult result)
{
if (resolvingError)
return; // Already attempting to resolve an error.
if (result.HasResolution)
try {
resolvingError = true;
result.StartResolutionForResult(context, 1001);
} catch (Exception e) {
Console.WriteLine("[SimpleLocation: Connection failed. Error: {0}]", e.Message);
googleApiClient.Connect(); // There was an error with the resolution intent. Try again.
}
else {
GooglePlayServicesUtil.GetErrorDialog(result.ErrorCode, context, 9000)?.Show();
resolvingError = true;
}
}
示例3: catch
IObservable<bool> IConnectionResultHandler.HandleConnectionResult(ConnectionResult connectionResult)
{
if (!connectionResult.HasResolution)
{
GoogleApiAvailability
.Instance
.GetErrorDialog(this, connectionResult.ErrorCode, 0)
.Show();
return Observable.Return(false);
}
try
{
this.resultResolutionSubject.Disposable = new Subject<bool>();
connectionResult.StartResolutionForResult(this, RequestCodeResolution);
return this.resultResolutionSubject.Disposable;
}
catch (IntentSender.SendIntentException)
{
return Observable.Return(false);
}
}
示例4: OnConnectionFailed
public void OnConnectionFailed(ConnectionResult result)
{
Log.Error(TAG, "Connect to Google API failed: {0}.", result.ErrorCode);
if (_authInProgress)
{
return;
}
if (!result.HasResolution)
{
return;
}
try
{
_authInProgress = true;
result.StartResolutionForResult(this, GOOGLE_PLAY_SERVICES_REQUEST_AUTHORIZATION);
}
catch (IntentSender.SendIntentException e)
{
_authInProgress = false;
Log.Error(TAG, "Could not resolve Google Play Services error: {0}", e.LocalizedMessage);
}
}
示例5: OnConnectionFailed
public void OnConnectionFailed (ConnectionResult result)
{
if (resolving)
return;
if (result.HasResolution) {
resolving = true;
result.StartResolutionForResult (activity, RC_RESOLVE);
return;
}
resolving = false;
SignedOut = false;
signingin = false;
if (OnSignInFailed != null)
OnSignInFailed (this, EventArgs.Empty);
}
示例6: OnConnectionFailed
public void OnConnectionFailed (ConnectionResult result)
{
if (mResolvingError)
return;
mPersonListView.Adapter = null;
try {
result.StartResolutionForResult (this, REQUEST_CODE_SIGN_IN);
mResolvingError = true;
} catch (Android.Content.IntentSender.SendIntentException) {
// Get another pending intent to run.
mGoogleApiClient.Connect ();
}
}
示例7: OnConnectionFailed
/// <summary>
/// Called when [connection failed].
/// </summary>
/// <param name="result">The result.</param>
public void OnConnectionFailed(ConnectionResult result)
{
if (this.resolving)
{
return;
}
if (result.HasResolution)
{
this.resolving = true;
result.StartResolutionForResult(this.activity, RC_RESOLVE);
this.adapter.OnActivityResult += this.OnConnectionFailedActivityResult;
return;
}
this.resolving = false;
this.SignedOut = false;
this.signingin = false;
if (this.OnSignInFailed != null)
{
this.OnSignInFailed(this, EventArgs.Empty);
}
}
示例8: ResolveLogin
/// <summary>
/// After we fail to connect to Google Play, it will tell us why. In some cases the
/// failure reason can be automatically resolved (eg. Login Required).
/// </summary>
/// <param name="result">The reason we failed to connect.</param>
private void ResolveLogin(ConnectionResult result)
{
// Does this failure reason have a solution?
if (result.HasResolution)
{
try
{
// Try to resolve the problem automatically.
result.StartResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
}
catch (Android.Content.IntentSender.SendIntentException /*e*/)
{
// Not really sure why this is here.
pGooglePlayClient.Connect();
}
}
}
示例9: OnConnectionFailed
public void OnConnectionFailed (ConnectionResult result)
{
if (Log.IsLoggable(Constants.TAG, LogPriority.Debug)) {
Log.Debug (Constants.TAG, "Disconnected from Google Api Service");
}
if (WearableClass.NodeApi != null) {
WearableClass.NodeApi.RemoveListener (mGoogleApiClient, this);
}
if (mResolvingError) {
// Already attempting to resolve the error
return;
} else if (result.HasResolution) {
try {
mResolvingError = true;
result.StartResolutionForResult (this, REQUEST_RESOLVE_ERROR);
} catch {
// There was an error with the resolution intent. Try again
mGoogleApiClient.Connect ();
}
} else {
mResolvingError = false;
}
}
示例10: ResolveLogin
/// <summary>
/// Checks to see if we have a resolution
/// </summary>
/// <param name="result">Result.</param>
private void ResolveLogin(ConnectionResult result)
{
if (result.HasResolution) {
try {
result.StartResolutionForResult (this, REQUEST_CODE_RESOLVE_ERR);
} catch (Android.Content.IntentSender.SendIntentException e) {
plusClient.Connect ();
}
} else if(progressDialog != null && progressDialog.IsShowing) {
progressDialog.Dismiss ();
}
}
示例11: OnConnectionFailed
public void OnConnectionFailed(ConnectionResult result)
{
_connectStopwatch.Stop();
Logger.Warn($"{_activity.GetType()} Google Play Services connection failed after {_connectStopwatch.ElapsedMilliseconds}ms: {result}");
if(IsResolvingError) {
return;
}
if(!result.HasResolution) {
Logger.Debug($"{_activity.GetType()} Google Play Services connection failure has no resolution, showing error dialog...");
// TODO: if the error here is service missing, bad things happen (as per the emulator behavior)
IsResolvingError = true;
GoogleApiAvailability.Instance.GetErrorDialog(_activity, result.ErrorCode, 0).Show();
IsResolvingError = false;
OnConnected(new PlayServicesConnectedEventArgs { IsSuccess = false });
return;
}
try {
IsResolvingError = true;
Logger.Debug($"{_activity.GetType()} Starting Google Play Services connection failure resolution activity...");
result.StartResolutionForResult(_activity, RequestCodeResolveError);
} catch(IntentSender.SendIntentException) {
Logger.Error($"{_activity.GetType()} Exception while starting resolution activity, retrying connection...");
ConnectAsync().Wait();
}
}