1. 程式人生 > >Android跳轉到應用商店的APP詳情頁面

Android跳轉到應用商店的APP詳情頁面

本篇文章對跳到應用商店詳情進行記錄

需求: 從App內部點選按鈕或連結,跳轉到應用商店的某個APP的詳情頁面

程式碼:

public class MarketUtil {
    /**
     * 啟動到應用商店app詳情介面   
     * @param appPkg    目標App的包名
     * @param marketPkg 應用商店包名 ,如果為"" 則由系統彈出應用商店
     * 列表供使用者選擇,否則調轉到目標市場的應用詳情介面,某些應用商店可能會失敗
     */
    public static void launchAppDetail(Context context, String appPkg, String marketPkg) {
        try
{ if (TextUtils.isEmpty(appPkg)) return; Uri uri = Uri.parse("market://details?id=" + appPkg); Intent intent = new Intent(Intent.ACTION_VIEW, uri); if (!TextUtils.isEmpty(marketPkg)) { intent.setPackage(marketPkg); } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } catch
(Exception e) { e.printStackTrace(); } } }

tips:如果應用商店包名為空 就會將手機上已下載的應用商店都列出來,讓你選擇一個進行跳轉。

主流應用商店對應的包名如下:
商店 包名
Google Play com.android.vending
應 用 寶 com.tencent.android.qqdownloader
360手機助手com.qihoo.appstore
百度手機助手com.baidu.appsearch
小米應用商店com.xiaomi.market
豌 豆 莢com.wandoujia.phoenix2
華為應用市場com.huawei.appmarket
淘寶手機助手com.taobao.appcenter
安卓市場com.hiapk.marketpho
安智市場cn.goapk.market

列出 Google GMS 各個apk的包名和類名,記錄一下:
轉自 https://blog.csdn.net/zheng_buding/article/details/42149379
Facebook [com.facebook.katana / com.facebook.katana.LoginActivity]

Chrome [com.Android.chrome / com.google.android.apps.chrome.Main]

Gmail [com.google.android.gm / com.google.android.gm.ConversationListActivityGmail]

Google+ [com.google.android.apps.plus / com.google.android.apps.plus.phone.HomeActivity]

Maps [com.google.android.apps.maps / com.google.android.maps.MapsActivity]

Play Movies [com.google.android.videos / com.google.android.youtube.videos.EntryPoint]

Play Books [com.google.android.apps.books / com.google.android.apps.books.app.BooksActivity]

Play Games
[com.google.android.play.games / com.google.android.gms.games.ui.destination.main.MainActivity]

Drive [com.google.android.apps.docs / com.google.android.apps.docs.app.NewMainProxyActivity]

YouTube [com.google.android.youtube / com.google.android.apps.youtube.app.WatchWhileActivity]

Photos [com.google.android.apps.plus / com.google.android.apps.plus.phone.ConversationListActivity]

Hangouts [com.google.android.talk / com.google.android.talk.SigningInActivity]

Play Store [com.android.vending / com.android.vending.AssetBrowserActivity]

Opera Mini [com.opera.mini.android / com.opera.mini.android.Browser]