Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android intents with multiple categories

I have a program that posts tweets on the user's behalf. Everything works in the AVD. However, I cannot seem to allow my program to have an icon. The strange thing is when I remove the lines for the BROWSABLE category and the data tag, the icon shows up and the program shows up in the program list as normal.

I think there is a problem with my Android Manifest, but I can't seem to get everything working. Please help!

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:theme="@style/Theme.AppCompat.Light"
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask" >
        <intent-filter>
            <category android:name="android.intent.category.BROWSABLE"/>
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.TAB"/>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="android.intent.action.VIEW"/>
            <data android:scheme="howsmydriving-oauth-twitter" android:host="callback"/>
        </intent-filter>
    </activity>

    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    <activity android:name="com.google.android.gms.ads.AdActivity"
         android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
like image 582
Namingwaysway Avatar asked Dec 13 '25 11:12

Namingwaysway


1 Answers

Alright, so, I figured out my problem.

I need two intent-filters for this. Changing the intent filter portion to the following allowed me to both view my app in the installed app listing and get the OAuth redirect:

        <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.VIEW" />
         <category android:name="android.intent.category.DEFAULT" />
         <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="howsmydriving-oauth-twitter" android:host="callback"/>
         </intent-filter>
like image 148
Namingwaysway Avatar answered Dec 14 '25 23:12

Namingwaysway



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!