启动 Spotify 意图

Cha*_*ake 5 android spotify android-intent google-play

我希望我的应用程序打开 Spotify 链接并将人们发送到该应用程序。如果安装了该应用程序,这会产生奇迹:

final Intent intent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("spotify:album:7rt7AxYexFTtdEqaJPekvX"));
Run Code Online (Sandbox Code Playgroud)

但是,在某些情况下还没有安装该应用程序,因此我希望他们从 Google Play 下载它,并具有以下其他意图:

final Intent intent = new Intent(
                    Intent.ACTION_VIEW,
                    Uri.parse("https://play.google.com/store/apps/details?id=com.spotify.mobile.android.ui"));
Run Code Online (Sandbox Code Playgroud)

但是,我真的希望它直接从 Google Play 安装,而不是让人们选择要打开的应用程序……如果安装了 Google Play。如果缺少 Google Play,我希望他们选择要打开的应用程序(通常是导航器,但无论如何)

有没有办法做到这一点?

Com*_*are 3

然而,我真的希望它直接从 Google Play 安装,而不是让人们选择打开哪个应用程序

使用market:// Uri代替https:// Urihttp://developer.android.com/distribute/googleplay/promote/linking.html

spotify:另外,请仅在公开记录和支持的情况下使用该方案。