Is it possible to discover and run third-party Android Instant Apps on an emulated device?

后端 未结 2 543
梦谈多话
梦谈多话 2021-02-05 15:16

I\'m currently trying to learn about Android instant apps. Since I don\'t own any real devices that support them, I\'m using the emulator (from Android Studio 3.0 Canary 9). I c

相关标签:
2条回答
  • 2021-02-05 15:30

    Is it possible to discover and open third-party Instant Apps on an emulated device (and if so, how)?

    At present, no. :( There are security restrictions in place preventing emulated devices from using various Google services. If you check the log, you might find a message similar to "io.grpc.StatusException: INVALID_ARGUMENT: Application credential header not valid. Please fix the client to pass a valid application credential header."

    On the API 26 emulated device, if I type adb shell pm list packages grep "com.google.android.instantapps.supervisor" returns nothing

    FYI, Supervisor isn't used for Android O.

    0 讨论(0)
  • 2021-02-05 15:42

    When you enable Android Instant App from App Link Assistant, your Activity that you want to directly launch (or have information on your website) gets modified as below:

    <activity
                android:name=".View.Activity.AboutActivity"
                android:parentActivityName="com.example1.uddhav.stopwatch.View.Activity.AboutActivity">
                <intent-filter android:autoVerify="true">
                    <action android:name="android.intent.action.VIEW" />
    
                    <category android:name="android.intent.category.DEFAULT" />
                    <category android:name="android.intent.category.BROWSABLE" />
    
                    <data
                        android:scheme="http"
                        android:host="your_web_address" />
                </intent-filter>
            </activity>
    

    Hence, when you get third-party apps, you must modify AndroidManifest.xml file as above.

    And, to be able to link your instant activity (for eg, AboutActivity), you have to save the generated assetlinks.json inside the .well-known folder of your website root folder as <your_web_site>/.well-known/assetlinks.json

    There is a reverse engineering tool that lets you modify AndroidManifest.xml file.

    Note: As you don't need uses-permission tag for Instant apps, you don't need to resign it.

    As you are not handling AppLink intent, you don't need

    // ATTENTION: This was auto-generated to handle app links.
    Intent appLinkIntent = getIntent();
    String appLinkAction = appLinkIntent.getAction();
    Uri appLinkData = appLinkIntent.getData();
    

    So, up to my understanding, it is possible to run third-party Android instant Apps on supported emulator devices. I apologize if I misunderstood your question.

    0 讨论(0)
提交回复
热议问题