2016-12-09 9 views
0

次のコードを使用して、WebブラウザのリンクからAndroidアプリを起動しようとしています。ウェブブラウザでURLリンクを使用してAndroidアプリを起動するにはどうすればよいですか?

<?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.example.rose.MoveMobile"> 

    <uses-permission android:name="android.permission.INTERNET" /> 

    <application 
     android:name=".app.MyApplication" 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" 
     tools:replace="android:icon"> 
     <activity 
      android:name=".Start" 
      android:configChanges="orientation" 
      android:label="@string/app_name" 
      android:screenOrientation="portrait"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
      <intent-filter> 
       <data android:scheme=".app.MyApplication" android:host="com.example.rose.MoveMobile"/> 
       <action android:name="android.intent.action.VIEW"/> 
        <category android:name="android.intent.category.DEFAULT"/> 
        <category android:name="android.intent.category.BROWSABLE"/> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

HTMLコード

<a href="http://MoveMobile.com.example.rose.MoveMobile">Launch Apps</a> 

おかげで、私は自分のアプリケーション

AndroidManifest.xmlを呼び出すために/修正マニフェストファイルとし、hrefのコードを調整するために助けてください

答えて

0

URLのスキームはhttpです。 <intent-filter>のスキームは.app.MyApplicationです。これらは同じではありません。 <intent-filter>httpに変更するか、または両方をブラウザが受け入れるように変更してください(.app.MyApplicationは有効な方法ではないと思われます)。

また、ブラウザからリンクからアプリを起動する必要はありません。彼らはそうかもしれないが、そうではないかもしれない。これはブラウザの開発者次第です。

+0

それはTHIのようなものです? HTMLコードはどうですか?私は本当に混乱しています。 – Jamilah

+0

@ジャミラ:「これはそう?」 - あなたのHTMLのあなたのURLによく一致します。 – CommonsWare

0
 <data android:scheme="http" 
      android:host="example.com" 
      android:pathPrefix="/myPath" /> 

これは、あなたは、HTTPにあなたのスキームを変更する必要が枯れ、またはあなたがmyappというようにカスタムスキームを使用するようにタグ内のリンクを変更する必要がhttp://example.com/myPath

で始まるすべてのものにマッチします:// somehost/somepath

+0

ありがとうございます。私はあなたの提案を最初に試みます:) – Jamilah

0
<activity 
     android:name=".Start" 
     android:configChanges="orientation" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
     <intent-filter> 
      <data android:scheme="app" android:host="com.example.rose.MoveMobile"/> 
      <action android:name="android.intent.action.VIEW"/> 
       <category android:name="android.intent.category.DEFAULT"/> 
       <category android:name="android.intent.category.BROWSABLE"/> 
     </intent-filter> 
    </activity> 

HTMLコード:
アプリ://com.example.rose.MoveMobile

+0

答えをありがとう。私はまずそれを試してみます。 :) – Jamilah

関連する問題