I was trying to make an app that automatically detects the OTP send via the default Android messaging app -


here code:

 btnsend.setonclicklistener(new view.onclicklistener() {      @override      public void onclick(view v) {         final string sentotp = randomnum();         if (!etnumber.gettext().tostring().trim().equals("")) {         uri uri = uri.parse("smsto:" + etnumber.gettext().tostring().trim());         intent smsintent = new intent(intent.action_sendto, uri);         smsintent.setflags(intent.flag_activity_new_task);         smsintent.putextra("sms_body", sentotp);         startactivity(smsintent);         inish();         intent = new intent(sendactivity.this, checkeractivity.class);         i.setflags(intent.flag_activity_new_task);         i.putextra("generatedotp", sentotp);         startactivity(i);         finish();         toast.maketext(sendactivity.this, "enter phone number!!", toast.length_long).show();         }    } }); 

upon clicking button, messaging app opens , backgrounded checkeractivity started. want when message app opens, send message, , click send button send message, checkeractivity gets started.

how can accomplish this? need set additional intent flags?

start sms intent results, on results can start activity.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -