eWizardII
eWizardII

Reputation: 1936

Handle Multiple Intents and Synchronize Data

Hello I'm trying to figure out how to process multiple intents,

In my manifest I have the following:

<receiver
    android:name="com.abc.ddd.ADR"
    android:exported="false">
    <intent-filter>
        <action android:name="com.abc.ddd.ACTIVITY_RECOGNITION_DATA" />
        <action android:name="com.abc.ddd.LOCATION_DATA" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</receiver>

In the broadcastreciever class I have the following:

public void onReceive(Context context, Intent intent) {
        String v = "Activity: " + intent.getStringExtra("act") + " " + "Confidence: " + intent.getExtras().getInt("confidence") + "\n";
        Log.i(TAG, v);

        String v2 = "lat: " + intent.getExtras().getDouble("lat") + " lon: " + intent.getExtras().getDouble("lon") + "\n";
        Log.i(TAG, v2);
}

How do I set it so that the Broadcast when triggered will pull data from both intents simultaneously, instead it seems to do it individually.

Upvotes: 0

Views: 56

Answers (1)

AncientMethods
AncientMethods

Reputation: 336

You should probably create a broadcast receiver for each intent action and listen to them seperately.

Upvotes: 1

Related Questions