Exemple #1
0
        public void OnSuccess(Java.Lang.Object result)
        {
            var n = result as LoginResult;

            if (n != null)
            {
                var request = GraphRequest.NewMeRequest(n.AccessToken, this);
                var bundle  = new Android.OS.Bundle();
                bundle.PutString("fields", "id, first_name, email, last_name, picture.width(500).height(500)");
                request.Parameters = bundle;
                request.ExecuteAsync();
            }
        }
        public override void OnTokenError(Exception exception, Bundle bundle)
        {
            string MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            Log.Info(MethodName, exception.Message);
            Intent intent = new Intent();

            intent.SetAction(HMSPushAction);
            intent.PutExtra(HMSPushReceiver.Method, System.Reflection.MethodBase.GetCurrentMethod().Name);
            Android.OS.Bundle bundleException = new Android.OS.Bundle();
            bundleException.PutString(HMSPushReceiver.Message, exception.Message);
            bundleException.PutInt(HMSPushReceiver.ErrorCode, ((BaseException)exception).ErrorCode);
            intent.PutExtra(HMSPushReceiver.Exception, bundleException);
            intent.PutExtra(HMSPushReceiver.Bundle, bundle);
            SendBroadcast(intent);
        }
        public override void OnMessageDelivered(string msgId, Exception exception)
        {
            // Obtain the error code and description.
            string MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            Log.Info(MethodName, $"msgId:{msgId}\nSituation:{exception.Message}");
            Intent intent = new Intent();

            intent.SetAction(HMSPushAction);
            intent.PutExtra(HMSPushReceiver.Method, System.Reflection.MethodBase.GetCurrentMethod().Name);
            intent.PutExtra(HMSPushReceiver.MsgId, msgId);
            Android.OS.Bundle bundle = new Android.OS.Bundle();
            bundle.PutString(HMSPushReceiver.Message, exception.Message);
            bundle.PutInt(HMSPushReceiver.ErrorCode, ((BaseException)exception).ErrorCode);
            intent.PutExtra(HMSPushReceiver.Exception, bundle);
            SendBroadcast(intent);
        }
        public void OnSuccess(Java.Lang.Object p0)
        {
            var n = p0 as LoginResult;

            if (n != null)
            {
                if (_isPermissionsLogin && _pTask != null)
                {
                    _isPermissionsLogin = false;
                    _pTask.TrySetResult(true);
                    _pTask = null;
                    return;
                }

                if (_isSimpleLogin)
                {
                    _isSimpleLogin = false;
                    if (tcss != null)
                    {
                        tcss.TrySetResult(true);
                    }
                    tcss = null;
                    return;
                }
                var request = GraphRequest.NewMeRequest(n.AccessToken, this);
                var bundle  = new Android.OS.Bundle();
                bundle.PutString("fields", "id, first_name, email, last_name, picture.width(500).height(500)");
                request.Parameters = bundle;
                request.ExecuteAsync();
            }
            else if (p0 is SharerResult)
            {
                if (tcsPhoto != null)
                {
                    tcsPhoto.TrySetResult(true);
                    tcsPhoto = null;
                }
            }
        }