I have these codes in broadcast receiver :
Intent mainActivityIntent =
*new* Intent(context, ir.smspeik.sms.GetResponse.*class*);
mainActivityIntent.setFlags(Intent.
*FLAG_ACTIVITY_NEW_TASK*);
context.startActivity(mainActivityIntent);
Intent broadcastIntent =
*new* Intent();
broadcastIntent.setAction(
"SMS_RECEIVED_ACTION");
*if*(broadcastIntent.getBooleanExtra("firstrun",*true*) == *true*)
{
broadcastIntent.removeExtra(
"firstrun");
broadcastIntent.putExtra(
"firstrun", *false*);
}
*else*
* *
{
broadcastIntent.putExtra(
"firstrun", *true*);
}
broadcastIntent.putExtra(
"sms", str);
Toast.*makeText*(context, broadcastIntent.getStringExtra(
"sms"), Toast.*LENGTH_SHORT*).show();
context.sendBroadcast(broadcastIntent);
*this*.abortBroadcast();
in my GetResponse I wrote these code :
*public* *void* onCreate(Bundle savedInstanceState) {
*super*.onCreate(savedInstanceState);
setContentView(R.layout.
*getresponse*);
Intent myint = getIntent();
// Toast.makeText(getApplicationContext(), myint.getExtras().getString("*
firstrun*"),
// Toast.LENGTH_SHORT).show();
*if*(myint.getBooleanExtra("firstrun",*true*) == *true*)
{
String s = myint.getStringExtra(
"sms");//.split("-");
// for(String i : s)
// {
Toast.*makeText*(getApplicationContext(),
"Ehsan can read " + s,
Toast.
*LENGTH_SHORT*).show();
// }
}
intentFilter = *new* IntentFilter();
intentFilter.addAction("SMS_RECEIVED_ACTION");
//---register the receiver---
registerReceiver(
intentReceiver, intentFilter);
}
I can access to firstrun in extras but sms is null. How can I access to sms
parameter?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en