We all know how we can use intent filters in our AndroidManifest.xml to declare the capabilities of actions such as search, push, etc. I am currently using such an intent filter to register a custom URL scheme as follows:
<activity android:name="NameOfActivity" > <intent-filter > <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWABLE" /> <data android:host="" android:scheme="customscheme" /> </intent-filter> </activity>
All this worked very well, until I decided to convert all my actions into fragments, since I needed to display the user interface differently on the tables. Now, on devices declared as large or large, instead of switching between actions, I have one action that removes and adds new fragments on request. This choice was made, since the left side of the screen always displays the same content, so instead of adding this content and all the actions, I change the fragments instead.
The problem is that while the intent filter starts the correct operation on the phone, this activity should never be launched on the tablet. Instead, I would like to handle this URL in the fragment. At the moment, I see no way to fix this. One thought was to programmatically add an intent filter, but after some research, I can't figure out if this is possible or not. Another thought was to somehow add an intent filter to the fragment, but that would not work, since the fragment cannot be launched without the activity hosting it.
In short : On the phone, I need one action to process the intent filter, but on the tablet I need another action to process the intent filter.
Is there any way to do this?
source share