Click on Android demand to jump to market review

Source: Internet
Author: User

I believe everyone has seen an option on the app "like this app?" and I want you to evaluate it! And then click on the pop-up selection box to let you choose a market such as: AZ Market, Baidu application, Pea pod ... then choose one and then jump to this market in your app column.

In fact, here is a simple intention:

   String mAddress ="market://details?id="+getPackageName();        new Intent("android.intent.action.VIEW");        marketIntent.setData(Uri.parse(mAddress));        startActivity(marketIntent);

Getpackagename (): This can be changed to another app's package name.

It's easy, huh? Look at the specific case

Case
  1. Java code:

     PackageCom.example.administrator.myapplication;ImportAndroid.content.Intent;ImportAndroid.net.Uri;Importandroid.support.v7.app.AppCompatActivity;ImportAndroid.os.Bundle;ImportAndroid.view.View; Public  class mainactivity extends appcompatactivity {    @Override    protected void onCreate(Bundle savedinstancestate) {Super. OnCreate (Savedinstancestate);    Setcontentview (R.layout.activity_main); } Public void OnClick(View view) {String maddress ="Market://details?id="+getpackagename (); Intent marketintent =NewIntent ("Android.intent.action.VIEW");        Marketintent.setdata (Uri.parse (maddress));    StartActivity (marketintent); }}
  2. Layout file

<?xml version= "1.0" encoding= "Utf-8"?><relativelayout xmlns:android="Http://schemas.android.com/apk/res/android" xmlns:tools="Http://schemas.android.com/tools"android:id="@+id/activity_main"  android:layout_width= "match_parent"android:layout_height="Match_ Parent "tools:context=" Com.example.administrator.myapplication.MainActivity ">                         <buttonandroid:onclick="OnClick"android:layout_width="Wrap_ Content "android:layout_height=" Wrap_content "android:text=" Go to Market Review " />                                 </relativelayout>

Click on Android demand to jump to market review

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.