lorenzoff
lorenzoff

Reputation: 1120

Broadcast & Intent Filters

A service send this broadcast:

Intent _broadcast = new Intent();
_broadcast.setAction("it.lorenzoff.uselesssoftware");
sendBroadcast(_broadcast);

Why my Activity in different package is not started up? In this second package i've declared the activity as the following:

<activity
  android:name=".FunnyActivity"
  android:launchMode="singleInstance" 
  android:clearTaskOnLaunch="true" >        
  <intent-filter>
    <action android:name="it.lorenzoff.uselesssoftware" />
  </intent-filter>      
</activity>

Have I to declare a BroadcastReceiver to manage this intent? But I want only to start an activity...

Upvotes: 1

Views: 89

Answers (1)

Frank Sposaro
Frank Sposaro

Reputation: 8531

Yes. You'll need to make a BroadcastReceiver that catches this intent and then starts the activity.

Right now your calling sendBroadcast(intent) however, your Activity's intent filter will not get this. It only gets startActivity(intent).

Upvotes: 1

Related Questions