Exemplo n.º 1
0
        public void ListenToSmsRetriever()
        {
            SmsRetrieverClient client = SmsRetriever.GetClient(Application.Context);
            var task = client.StartSmsRetriever();

            task.AddOnSuccessListener(new SuccessListener());
            task.AddOnFailureListener(new FailureListener());
        }
Exemplo n.º 2
0
        public void RetrieveOtp(Action <string> callback)
        {
            SmsRetrieverClient client = SmsRetriever.GetClient(BaseApplication.MainActivity);

            BaseApplication.MainActivity.OtpCallback = message => {
                string otp = Regex.Match(message, @"\d{6}")?.Value;
                callback(otp);
            };

            Task task = client.StartSmsRetriever();
        }
Exemplo n.º 3
0
        public void StartSMSRetriverReceiver()
        {
            SmsRetrieverClient _client = SmsRetriever.GetClient(global::Android.App.Application.Context);
            // Starts SmsRetriever, which waits for ONE matching SMS message until timeout
            // (5 minutes). The matching SMS message will be sent via a Broadcast Intent with
            // action SmsRetriever#SMS_RETRIEVED_ACTION.
            var task = _client.StartSmsRetriever();

            // You could also Listen for success/failure of StartSmsRetriever initiation
            //task.AddOnSuccessListener(new SuccessListener());
            //task.AddOnFailureListener(new FailureListener());
        }
        public void ListenToSmsRetriever()
        {
            // Get an instance of SmsRetrieverClient, used to start listening for a matching
            // SMS message.
            SmsRetrieverClient client = SmsRetriever.GetClient(Application.Context);
            // Starts SmsRetriever, which waits for ONE matching SMS message until timeout
            // (5 minutes). The matching SMS message will be sent via a Broadcast Intent with
            // action SmsRetriever#SMS_RETRIEVED_ACTION.
            var task = client.StartSmsRetriever();

            // Listen for success/failure of the start Task. If in a background thread, this
            // can be made blocking using Tasks.await(task, [timeout]);
            task.AddOnSuccessListener(new SuccessListener());
            task.AddOnFailureListener(new FailureListener());
        }
Exemplo n.º 5
0
        private void btnStartSMSRetreiver_OnClick(object sender, EventArgs eventArgs)
        {
            // Get an instance of SmsRetrieverClient, used to start listening for a matching SMS message.
            _client = SmsRetriever.GetClient(this.ApplicationContext);
            // Starts SmsRetriever, which waits for ONE matching SMS message until timeout
            // (5 minutes). The matching SMS message will be sent via a Broadcast Intent with
            // action SmsRetriever#SMS_RETRIEVED_ACTION.
            var task = _client.StartSmsRetriever();

            // You could also Listen for success/failure of StartSmsRetriever
            task.AddOnSuccessListener(new SuccessListener());
            task.AddOnFailureListener(new FailureListener());

            Snackbar.Make((View)sender, "SMS Retriever started...", Snackbar.LengthShort).Show();
            tvSMSContent.Text = $"SMS retrieval results will be shown here...";
        }
Exemplo n.º 6
0
        public void StartSMSRetrieverReceiver()
        {
            SmsRetrieverClient client = SmsRetriever.GetClient(Application.Context);

            client.StartSmsRetriever();
        }