Hi
I have here two applications in two different projects in eclipse. One application (A) defines an activity (A1) which is started first. Then i start from this activity the second activity (B1) in the second project (B). This works fine.
I start it the following way:
Intent intent = new
Intent("pacman.intent.action.Launch");
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
Now i want to send intents bewtween the two activities by using broadcast receivers. In activity A1 i send the intents the following way:
Intent intent = new
Intent("pacman.intent.action.BROADCAST");
intent.putExtra("message","Wake up.");
sendBroadcast(intent);
The part of the manifest file in activity A1 that is responsible for this broadcast is the following:
<activity android:name="ch.ifi.csg.games4blue.games.pacman.controller.PacmanGame" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.BROADCAST" />
</intent-filter>
</activity>
In the receiving activity, I define the receiver the following way in the manifest file:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".PacmanGame"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="pacman.intent.action.Launch" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<receiver android:name="ch.ifi.csg.games4blue.games.pacman.controller.MsgListener" />
</activity>
</application>
The class message listener is implemented this way:
public class MsgListener extends BroadcastReceiver {
/* (non-Javadoc)
* @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent)
*/
@Override
public void onReceive(Context context, Intent intent) {
System.out.println("Message at Pacman received!");
}
}
Unfortunately, the message is never received. Although the method in activity A1 is called, i never receive an intent in B1.
Any hints how to solve this?
Thanks a lot!