LoginSignup
4
5

More than 3 years have passed since last update.

【Android】アプリがあればアプリへ飛ばし、なければストアに飛ばす

Last updated at Posted at 2019-02-07

タイトルの通りです、簡単ですが調べてもなかなか出なかったので・・・

飛ばしたいActivityにintent-filterを追加

AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.ringored.app">

       <activity ...>
            <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:path="/"
                    android:scheme="scheme"
                    android:host="host"/>
            </intent-filter>

URIの書き方

URIの構成は以下の通りです
android-app://{package_id}[/{scheme}[/{host}[/{path}]]][#Intent;{...}]

詳しくはこちら

上記の通りの実装の場合URIは
「android-app://com.ringored.app/scheme/host/」となります。

パラメータを乗せて飛ばすこともできます。

4
5
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5