Step7. Sharing URL

    Step7. Sharing URL


    Article summary

    Through Shoplive's Share API, you can easily share the broadcast's URI Scheme or URL.

    Set the format of shared links

    URI Scheme

    <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>

    Scheme

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

    URL

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


    Use the custom-system’s shared 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()
    }

    You can share the link of the currently playing broadcast with others or on social media, allowing users to install the app or watch the broadcast simply by clicking the link. (Note, however, that the app must handle the deeplink separately.)