Search code examples
androidtizensamsung-galaxy-gear

Intent to open Tizen / Galaxy / Samsung App Store on Android phone


I've built a Tizen/Samsung smartwatch companion app for an Android app. Inside the Android app, I can detect if a Samsung/Tizen watch is paired to the Android phone, but missing the smartwatch companion app.

I am prompting the user to install the smartwatch companion app if they don't have it. However, I'd like to make it very easy for the user to get the companion app, by providing a button for them to click that will open the Galaxy Store straight to the smartwatch companion app download page.

Is there an intent for opening the Galaxy Store to a specific app page on an Android phone?

I've tried this based on other answers on SO:

val intent = Intent(Intent.ACTION_VIEW, Uri.parse("samsungapps://ProductDetail/com.sec.android.app.samsungapps"))
startActivity(intent)

That crashes with:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=samsungapps://ProductDetail/com.sec.android.app.samsungapps }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2058)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1716)
    at android.app.Activity.startActivityForResult(Activity.java:5211)
    at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:675)
    at android.app.Activity.startActivityForResult(Activity.java:5169)
    at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:662)
    at android.app.Activity.startActivity(Activity.java:5540)
    at android.app.Activity.startActivity(Activity.java:5508)

Note: I need a solution that works on ALL Android phones with the Galaxy Store, not just Samsung phones.


Solution

  • It's other way around. As I've explained here, you need to add the following tag to config.xml of your watch app to auto-install the companion app on Android from Play Store.

    <metadata key="master_app_playstore_deeplink" value="market://details?id={package_id}"/>
    

    If you distribute your Android app through Samsung's Galaxy App Store, then you would need to use "samsungapps://" scheme.

    Android system doesn't know anything about either scheme and that's why you're getting that exception and that's why using these schemes in the Android's Intent won't work.

    If there is other way of doing what you want, I don't know - you'll need to research. There could be something in Android's SAP libraries provided by Samsung.