4

カスタム URL からアプリを実行したいと考えています。AndroidManifest に以下を追加しました。

<activity android:name=".app.RunFromUrlActivity"
            android:launchMode="singleInstance">
            <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="myapp"/>
            </intent-filter>
</activity>

ただし、 myapp://data に移動しようとすると、ブラウザはアクティビティを実行する代わりにその文字列を検索するだけです。

私は何を間違っていますか?

4

1 に答える 1

1

「データ」については、次のようにしてください。

<data
    android:host="com.yourpackage.yourotherstuff.TheActivity"
    android:scheme="yourscheme" />

私のアプリで機能するものは次のとおりです。

<activity android:name=".BrowserActivity" >
    <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:host="com.mypackage.otherstuff.BrowserActivity"
            android:scheme="myapp" />
    </intent-filter>
</activity>

これにより、myapp://com.mypackage.otherstuff.BrowserActivity からアクティビティにアクセスできるようになります。

于 2012-06-26T22:38:43.867 に答える