Android SMS opens APP

  1. Requirement description: The user receives a text message and clicks the text message link to open the APP. Some open it directly without downloading the APP.
  2. Functional analysis: First write an H5 interface. The interface content has two buttons, one to download and one to open. There is no need to click download to install. There is a way to directly open the APP, and then use the Scheme protocol in Android to invoke the APP.
  3. Specific function implementation:

H5 simple code

				<button
					onClick={() => onDownload()}
				>
					点击下载APP
				</button>
				<button
					onClick={() => onOpenApp()}
				>
					已经下载打开APP
				</button>

	//下载方法
	function onDownload() {
		window.location.href =
			”这里放下载链接“;
	}
	//打开APP方法
	function onOpenApp() {
		window.location.href =
			'park://testjeean'//这个地址是自己在Android里面定义的下面会说到
	}

Android implementation code

URL Scheme protocol format
Insert image description here
'park://testjean' I just made a simple jump here, and can also take parameters. If you need it, you can find it yourself.
How to use Android APP

        <activity
            android:name=".activity.MainActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="park"
                    android:host="testjeean"
                    />
            </intent-filter>
        </activity>

Just write it in the manifest file of the activity that needs to be jumped.

The rendering is as follows: Click download and a prompt box at the bottom will pop up.
Insert image description here

Scheme protocol extension
https://blog.csdn.net/qq_34906385/article/details/121344153

Guess you like

Origin blog.csdn.net/u010689434/article/details/126505162