Reputation: 16110
I am currently doing a custom scheme intent-filter to open my own app from the browser.
Is it possible to instead opening an activity to launch a broadcast receiver.
My current code for the activity broadcast receiver is like this:
<action android:name="android.intent.action.VIEW" >
</action>
<category android:name="android.intent.category.DEFAULT" >
</category>
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="shortener.com"
android:scheme="shortener" >
</data>
</intent-filter>
Here is my receiver code. Doesn't trigger. tried a View action and a custom action
<receiver android:name="MyReceiver" >
<intent-filter>
<action android:name="com.dg.action.CONFIGURE" >
</action>
<category android:name="android.intent.category.DEFAULT" >
</category>
<data
android:host="shortener.com"
android:scheme="shortener" >
</data>
</intent-filter>
</receiver>
Upvotes: 5
Views: 4342
Reputation: 1436
I know this is old, but since there's no clear and accepted answer on it, what the hey. As the official documentation puts it:
...the Intent broadcast mechanism .. is completely separate from Intents that are used to start Activities with Context.startActivity(). There is no way for a BroadcastReceiver to see or capture Intents used with startActivity(); likewise, when you broadcast an Intent, you will never find or start an Activity. These two operations are semantically very different: starting an Activity with an Intent is a foreground operation that modifies what the user is currently interacting with; broadcasting an Intent is a background operation that the user is not normally aware of.
Source: Android Developer Documentation, BroadcastReceiver
Hope that makes it clear.
Upvotes: 12