public static void openGooglePlay(Activity ac, Dialog alertDialog){ final String appPackageName = ac.getPackageName(); // getPackageName() from Context or Activity object try { ac.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { ac.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); } alertDialog.dismiss(); } public static int getVersionCode(Context ct){ PackageInfo packageInfo = getPackageInfo(ct); if (packageInfo!=null){ return packageInfo.versionCode; } return 0; } public static PackageInfo getPackageInfo(Context ct){ PackageInfo pInfo = null; try { pInfo = ct.getPackageManager().getPackageInfo(ct.getPackageName(), 0); return pInfo; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return null; }
Trang Chủ
Android
PHP
Chuỗi
Dialog
Clipboard
Spinner
Auto Layout
ActionBar
Intent
Random
SQL
Admod
Version
TextView
Tabhost
Json
ListView
Time Picker
Calendar
Ham
FloatingActionMenu
Button
EditText
Activity
Custom Adapter
Xoay Màn Hình
Wifi & 3G
Lỗi
Fragment
Shape
SMS
Push
FireBase
CheckBox
Mảng
Facebook
Timer
Service
Text To Speech
Recycler View
Search This Blog
Tuesday, August 8, 2017
Mở link CHPLAY
Labels:
android
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment