Android application development process, there may be needs, such as: Jump to the application market to download applications, jump to the application market to their own application scoring, jump to the application market to update their own applications. So how do you jump to the app market?
Possible ways to jump everyone knows, the method is as follows:
static void goToMarket(Context context, String packageName) { Uri uri = Uri.parse("market://details?id=" + packageName); Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); try { context.startActivity(goToMarket); } catch (ActivityNotFoundException e) { e.printStackTrace(); }}
This method supports the mainstream application market, such as app Bao, 360 mobile phone assistants, pea pods, Xiaomi stores, etc., when the mobile phone has more than one application market, it will pop up the menu to let the user choose which market to switch to. Then, the question comes, if so simple to end, how can there be this article?
? On the red Rice Note2 test found that call this method by default is directly to the Xiaomi market, if on the Xiaomi phone, want to jump to the app Bao or other application market how to do it, the method is naturally there, as follows:
public static void Gotomarket (Context context, string packagename) {Uri URI = uri.parse ( "market://details?id=" + packageName); Intent gotomarket = new Intent (Intent.action_view, URI); try {gotomarket.setclassname ( " Com.tencent.android.qqdownloader ", " com.tencent.pangu.link.LinkProxyActivity "); Context.startactivity (Gotomarket); } catch (activitynotfoundexception e) {e.printstacktrace ();}}
The
seems to be no different from the first method, yes, just call the Gotomarket.setclassname () method and set the specified app to handle the intent event so that you can jump to the app details page on the Xiaomi phone, and The previous method if there is more than one app market on the phone, it will pop up the menu to let the user choose, if you have determined to jump to which application market, you can also use this method, direct jump, save the middle user select link.
? But the idea of the above method does not seem to be effective for all the application market, which day the product manager proposed to jump to Samsung's application market, after all, Samsung mobile phone in the domestic share or row before several, and then use the method above, found that the Samsung market did not support this way, No wonder Samsung phones are losing their home market. However, the efforts of the author finally found the following method:
public static void Gotosamsungappsmarket ( context context, String packagename) {uri uri = Uri.parse (
"http://www.samsungapps.com/appquery/appDetail.as?appId=" + packagename)
; Intent gotomarket = new Intent () " Com.sec.android.app.samsungapps.Main ") ; Gotomarket.setdata (URI) context.startactivity ( Gotomarket) ; }}
? However, later found in the Lego mobile phone above, the application of the market is also not supported Gotomarket () method, so we have specifically researched the method of jumping the market for the application of music, the method is as follows:
void goToLeTVStoreDetail(Context context, String packageName) { Intent intent = new Intent(); intent.setClassName("com.letv.app.appstore", "com.letv.app.appstore.appmodule.details.DetailsActivity"); intent.setAction("com.letv.app.appstore.appdetailactivity"); intent.putExtra("packageName", packageName); context.startActivity(intent); }
The above methods, hoping to help people in need.
If you have any questions about the contents of the article, please correct me.
From:http://www.jianshu.com/p/2165acb5d1eb
"Go" Android app how to jump to app market Details page