The ability to open the app market in Android

Source: Internet
Author: User

Many Android apps have a feature that scores for us, that is, click to open the relevant app in the app market details page.
In fact, this feature is very simple to implement.
Open the App details page

 try {Intent i = new Intent (Intent _view) ;  I.setdata  (Uri.parse  (" market://details?id= " +getpackagename ())             StartActivity (i)  } catch (Exception e) {toast.maketext  (Settingactivity.this , " The Android app market is not installed on your phone ", Toast _short) .show  ()  E.printstacktrace  ()  }

The Getpackagename () above is the name of the package you have applied to yourself.

Find apps in the app market

try {                new Intent(Intent.ACTION_VIEW);                i.setData(Uri.parse("market://search?q=pub:Your Publisher Name"));                startActivity(i);            catch (Exception e) {                "您的手机上没有安装Android应用市场", Toast.LENGTH_SHORT).show();                e.printStackTrace();            }

The ability to open the app market in Android

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.