Android: In Lollipop sms, the intention is not to return to the application

I use this code to open SMS Intent in my Android app. But after sending an SMS, it does not return to the application on the device with a lollipop, while it works fine in lower versions (tested on Beans jelly).

String sentSMS = "xxxxxxxx" String cellNumber = "xxxxx" sentSMSId = generateId(); Intent sendIntent = new Intent(Intent.ACTION_SENDTO); sendIntent.setData(Uri.parse("sms:" + cellNumber)); sendIntent.putExtra("sms_body", sentSMS); sendIntent.putExtra("exit_on_sent",true); startActivityForResult(sendIntent,1001); 
+5
source share
1 answer

When I applied your .app code, it is possible to return to action correctly

  public void Ok(View v){ String sentSMS = "asd"; String cellNumber = "123"; Intent sendIntent = new Intent(Intent.ACTION_SENDTO); sendIntent.setData(Uri.parse("sms:" + cellNumber)); sendIntent.putExtra("sms_body", sentSMS); sendIntent.putExtra("exit_on_sent",true); startActivityForResult(sendIntent,1001); } @Override public void startActivityForResult(Intent intent, int requestCode, Bundle options) { super.startActivityForResult(intent, requestCode, options); if (requestCode==1001) Toast.makeText(this,"hai",Toast.LENGTH_SHORT).show(); } 

This is what I have tried so far. I launched the application on the device with lollipop and after sending the message the control will return to our application.

0
source

All Articles