0

My activity is not shown in the chooser list when requesting ACTION_VIEW. What is wrong in my code? In the emulator -> Settings -> Apps -> Default apps -> Browser app, I see my app correctly (Chrome is default). If I set my activity to be the default browser, for sure it is called without problem. A chooser shouldn't show it in the list even if it is not the default app?

Activity that simulates a Browser:

<activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT" />
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="http"/>
            </intent-filter>

            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>

Activity in another app that requests an ACTION_VIEW:

Intent intent = new Intent(Intent.ACTION_VIEW);
 intent.setData(Uri.parse("http://www.google.com"));
 Intent intentChooser = Intent.createChooser(intent,"Choose an app");
 startActivity(intentChooser);

I tried with other actions, the same problem is encountered as with ACTION_VIEW.

Ali
  • 1

0 Answers0