preface

The Intent of this class is a commonly used class in the development, represents an intention (obtaining understanding as the goal, purpose), first of all we need is clear: any browser link is an implicit Intent, open a browser way is the purpose of the explicit and implicit intention, just so we configure filters can!

The sample

First of all, the project catalog is shown as follows:

MainActivity and layout file do not need to be changed. The key is the configuration of LocalAppAty in the Sse file:

<? The XML version = "1.0" encoding = "utf-8"? > <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.xpu.launchlocalapp"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:> <intent-filter> <action android: /> <category android: /> </intent-filter> </activity> <activity android:> <intent-filter> <! -- Activity that can be started by the browser --> <category Android :></category> </category> <action Android :></action> <data android:scheme="app" ></data> </intent-filter> </activity> </application> </manifest>Copy the code

The JavaWeb project is as follows, a very simple tag:

Generally, android emulators need to access the local IP address, using 10.0.0.2, the same port number as your server, mine is 8080:

Successful opening:

Get the information to start the Activity.