Step7. 共有用URL

    Step7. 共有用URL


    記事の要約

    ShopliveのShare APIを通じて、ライブ放送の URI Scheme もしくは URLを簡単に共有できます。


    共有リンクの書式設定

    URI スキーム

    <activity
            android:name=".SchemeActivity"
            android:theme="@style/Transparent"
            android:launchMode="singleTask"
            android:screenOrientation="portrait">
        <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="your_scheme" android:host="your_host" />
        </intent-filter>
    </activity>

    Plain Text

    val scheme = "{your_scheme}://{your_host}?ak=xxx&ck=yyy"
    ShopLive.setShareScheme(scheme)

    Plain Text

    URL

    val url = "https://www.share_link.com/?ak=xxx&ck=yyy"
    ShopLive.setShareScheme(url)

    Plain Text


    カスタムシステム共有UIの使用

    override fun handleShare(context: Context, shareUrl: String) {
        val inflater = getSystemService(LAYOUT_INFLATER_SERVICE) as LayoutInflater
        val view = inflater.inflate(R.layout.custom_share_dialog, null)
    
        val builder = AlertDialog.Builder(context)
        builder.setView(view)
    
        val dialog = builder.create()
        dialog.show()
    }

    Plain Text

    再生中の放送のリンクを他のユーザーやSNSに共有し、リンクをクリックするだけでアプリのインストールや配信の視聴を誘導することもできます。(ただし、アプリではディープリンクを個別に処理する必要があります。