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

人盡茶涼 提交于 2019-12-03 02:05:53

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!