Hi,
I am having two apps in which one app(AppA) consists only BroadCastReceiver
and another app(AppB) is having an Activity from there I am sending a
broadcast to the AppA.
But I am not getting any event in AppA in which I have implemented the
onReceive function.
*AppA and it's manifest file:*
public class AppA extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equalsIgnoreCase("com.MyAction")){
String s = intent.getStringExtra("MyValue");
}
}
}
manifestFile:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.justreceiver"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<receiver
*android:name="com.example.AppA"*
android:label="@string/app_name" >
<intent-filter>
* <action android:name="com.MyAction" />*
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
*Application B from where I am sending the broadcast:*
*
*
public class AppB extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button send = (Button)findViewById(R.id.send);
send.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent();
i.setAction("com.MyAction");
i.putExtra("MyValue", "Yahooooooo");
sendBroadcast(i);
}
});
}
}
why I am not getting intent on AppA.... ?Can anyone help me on this.
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.