google-developer-training / android-fundamentals-apps-v2

Other
649 stars 2.63k forks source link

Android Kotlin Fundamentals codelab: failed to pop the chooser #354

Closed black-pwq closed 1 year ago

black-pwq commented 2 years ago

Describe the problem

in codelab Android fundamentals 02.3:Implicit intents, it says we can open another application using implicit intents. But after i implemented the two applications (suggested in the taks 5 in that lab), it failed to open the app that i implemented. However it always opens the default application (say, chrome when open a website), and i cannot see the chooser. I tested in both emulator and my own physical device, the results were same. I guess this is caused by the high API level i used, or something should be added in my manifest.

In which lesson and step of the codelab can this issue be found? Android fundamentals 02.3:Implicit intents, step 7(Task 5: Receive an implicit Intent)

How to reproduce? click the "open website" button

Versions

  1. What version of Android Studio are you using?

Android Studio Dolphin | 2021.3.1 Build #AI-213.7172.25.2113.9014738, built on September 1, 2022

  1. What API level are you targeting?

targetAPI 31 miniAPI 21

Additional information manifest of Implicit Intents:

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="http" />
        </intent>
    </queries>

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.ImplicitIntents"
        tools:targetApi="31">
        <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>

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

manifest of Implicit Intents Receiver

    <activity
        android:name=".MainActivity"
        android:exported="true">

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.APP_BROWSER" />
            <data android:scheme="http" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

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

basicly, other code are same as the codelab's.

codelab: android-fundamentals

jlulovics commented 1 year ago

Hello! Thank you for your feedback. This codelab is out of date and no longer maintained. Instead, please refer to the Android Basics with Compose course for the latest recommended practices. If you are looking for content on Views, you can check out the Android Basics in Kotlin course.