【问题标题】:How to make html to android app launch hyperlink?如何使 html 到 android 应用程序启动超链接?
【发布时间】:2017-05-18 21:19:04
【问题描述】:

我是 Android 开发的新手。 我不知道如何创建 android 应用程序启动超链接并将其嵌入 HTML 页面。 我的情况是,当任何人点击此链接时,android 应用程序将自动启动,(应用程序将预先安装到设备中。)

这是清单代码:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:"http://schemas.android.com/apk/res/android" android:versionCode="9" android:versionName="1.0.4" package="com.happyconz.wherelive" platformBuildVersionCode="22" platformBuildVersionName="5.1.1-1819727">
    <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="21" />
    <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:resizeable="true" android:xlargeScreens="true" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.NETWORK" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="com.happyconz.wherelive.permission.INTERNAL" />
    <permission android:name="com.happyconz.wherelive.permission.INTERNAL" android:protectionLevel="signature|signatureOrSystem" />
    <application android:theme="0x7f0b0095" android:label="0x7f09028c" android:icon="0x7f02011d" android:name="com.happyconz.wherelive.GlobalApplication" android:allowBackup="true" android:largeHeap="true">
        <activity android:theme="0x7f0b0099" android:label="0x7f09028c" android:name="com.happyconz.wherelive.activity.HomeActivity" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="0x7f0b0095" android:label="0x7f09028c" android:name="com.happyconz.wherelive.Main" android:configChanges="keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:label="0x7f09011e" android:name="com.happyconz.wherelive.about.CustomActivity" />
        <activity android:theme="@style/Theme_AppCompat_Light_NoActionBar" android:label="0x7f09028c" android:name="com.happyconz.wherelive.video.youtube.sign.LoginActivity" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="@style/Theme_AppCompat_Light_NoActionBar" android:label="0x7f09028c" android:name="com.happyconz.wherelive.video.youtube.sign.LogoutActivity" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="0x7f0b0099" android:name="com.happyconz.wherelive.recode.Recorder" android:permission="com.happyconz.wherelive.permission.INTERNAL" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="com.happyconz.wherelive.action.Recorder" />
            </intent-filter>
        </activity>
        <activity android:theme="0x7f0b008f" android:name="com.happyconz.wherelive.CertFailDialog" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:label="0x7f09025a" android:icon="0x7f020121" android:name="com.happyconz.wherelive.video.MyLiveListActivity" android:launchMode="standard" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:label="0x7f090259" android:icon="0x7f020121" android:name="com.happyconz.wherelive.video.LiveListActivity" android:launchMode="standard" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:label="0x7f09003f" android:icon="0x7f020121" android:name="com.happyconz.wherelive.preference.InfoActivity" android:launchMode="standard" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="0x7f0b0095" android:name="com.happyconz.wherelive.activity.WebViewActivity" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="@*android:style/Theme.NoDisplay" android:name="com.happyconz.wherelive.video.youtube.sign.CheckAuthActivity" />
        <activity android:theme="0x7f0b0095" android:name="com.happyconz.wherelive.video.CreateChannelActivity" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="0x7f0b0095" android:name="com.happyconz.wherelive.video.CreateLiveChannelActivity" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="@*android:style/Theme.Translucent" android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
        <activity android:theme="@*android:style/Theme.Translucent.NoTitleBar" android:name="com.happyconz.wherelive.adv.AdEverFullScreen" android:taskAffinity="com.wherelive.pro" android:launchMode="singleTask" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
        <activity android:theme="@style/Theme_AppCompat_Light_NoActionBar" android:name="com.happyconz.wherelive.adv.AdMainFullScreen" android:launchMode="singleTask" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
        <activity android:theme="0x7f0b0098" android:icon="0x7f020121" android:name="com.happyconz.wherelive.preference.SettingActivity" android:launchMode="standard" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="0x7f0b0098" android:icon="0x7f020121" android:name="com.happyconz.wherelive.preference.AccountSettingActivity" android:launchMode="standard" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="0x7f0b0098" android:icon="0x7f020121" android:name="com.happyconz.wherelive.preference.ScreenSettingActivity" android:launchMode="standard" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="0x7f0b0098" android:icon="0x7f020121" android:name="com.happyconz.wherelive.preference.LiveSettingActivity" android:launchMode="standard" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="0x7f0b0098" android:icon="0x7f020121" android:name="com.happyconz.wherelive.preference.MoreSettingActivity" android:launchMode="standard" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:icon="0x7f020121" android:name="com.happyconz.wherelive.preference.SettingProActivity" android:taskAffinity="com.wherelive.pro" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation|screenSize" android:allowTaskReparenting="true">
            <intent-filter>
                <action android:name="com.happyconz.wherelive.preference.SettingActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:theme="@*android:style/Theme.NoDisplay" android:name="com.happyconz.wherelive.LicenseChecker" />
        <receiver android:name="com.happyconz.wherelive.recode.service.AlarmReceiver" android:process=":remote">
            <intent-filter android:priority="995">
                <action android:name="com.happyconz.wherelive.recode.service.alarm" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.happyconz.wherelive.receiver.AuthReceiver" android:process=":remote">
            <intent-filter android:priority="998">
                <action android:name="com.happyconz.wherelive.recode.service.certification" />
            </intent-filter>
        </receiver>
        <receiver android:label="0x7f09028c" android:icon="0x7f020120" android:name="com.happyconz.wherelive.recode.widget.AutoboyWidgetProvider">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                <action android:name="android.intent.action.USER_PRESENT" />
            </intent-filter>
            <meta-data android:name="android.appwidget.provider" android:resource="0x7f070001" />
        </receiver>
        <service android:name="com.happyconz.wherelive.recode.service.RecorderService" android:exported="true">
            <intent-filter android:priority="999">
                <action android:name="com.happyconz.wherelive.recode.service.IRecorderService" />
                <action android:name="com.happyconz.wherelive.RECORDER_SERVICE" />
            </intent-filter>
        </service>
        <service android:name="com.happyconz.wherelive.recode.service.CertificationService" />
        <service android:name="com.happyconz.wherelive.recode.widget.AutoboyWidgetService" />
        <service android:name="com.happyconz.wherelive.video.youtube.streaming.StreamerService" />
        <meta-data android:name="com.crashlytics.ApiKey" android:value="e357fa9000ab877757425745ec7b43ad971b647b" />
        <meta-data android:name="com.google.android.gms.version" android:value="0x7f0e0006" />
        <activity android:theme="0x7f0b0098" android:label="0x7f090211" android:name="com.happyconz.wherelive.sns.SNSSettingActivity" android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:theme="@*android:style/Theme.Translucent.NoTitleBar" android:label="0x7f09028c" android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize" />
        <activity android:label="0x7f09028c" android:name="com.happyconz.wherelive.sns.twitter.TwitterActivity">
            <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="oauth" android:host="com.happyconz.wherelive.sns" />
            </intent-filter>
        </activity>
        <activity android:label="0x7f09028c" android:name="com.happyconz.wherelive.sns.twitter.TwitterProActivity" android:taskAffinity="com.wherelive.pro" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation|screenSize" android:allowTaskReparenting="true">
            <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="oauth" android:host="com.happyconz.wherelive.sns.pro" />
            </intent-filter>
        </activity>
        <activity android:name="com.happyconz.wherelive.sns.twitter.OAuthActivity" />
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="0x7f09032a" />
        <meta-data android:name="io.fabric.ApiKey" android:value="180b89f527bdd6961fab824c28327acefbae668c" />
        <activity android:name="com.mikepenz.aboutlibraries.ui.LibsActivity" />
    </application>
</manifest>

【问题讨论】:

  • 语法是什么,能告诉我
  • 您需要在 Manifest 中添加一些代码。由于上述代码是反编译的清单,我认为您必须访问该应用程序的项目,然后使用新的清单重新编译它。另外,检查这个; stackoverflow.com/questions/3469908/…

标签: android html hyperlink


【解决方案1】:

或者另一种选择是;

找到应用程序包名后,如果应用程序在商店中,您可以将其链接到应用程序链接到商店,如果已经安装,用户可以点击“打开”按钮。

所以链接到:

market://search?q=pname:<package_name>

或者:

http://market.android.com/search?q=pname:<package_name>

【讨论】:

    猜你喜欢
    • 2014-11-01
    • 2017-05-27
    • 2013-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-04
    • 2011-03-15
    • 2013-09-12
    相关资源
    最近更新 更多