打开手机应用商店的评论调研
目前国内主流的应用商店ov,华为,小米和应用宝中,只有oppo和vivo支持APP直接拉起应用商店评分
0x01 Oppo应用商店评分
Oppo应用评论调起的官方文档:
https://open.oppomobile.com/new/developmentDoc/info?id=11038
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| private final static String PKG_MK_HEYTAP = "com.heytap.market"; private final static String PKG_MK_OPPO = "com.oppo.market"; private final static String COMMENT_DEEPLINK_PREFIX = "oaps://mk/developer/comment?pkg="; private final static int SUPPORT_MK_VERSION = 84000;
public static boolean jumpToComment(Activity context) { String url = COMMENT_DEEPLINK_PREFIX + context.getPackageName(); if (getVersionCode(context, PKG_MK_HEYTAP) >= SUPPORT_MK_VERSION) { return jumpApp(context, Uri.parse(url), PKG_MK_HEYTAP); } if (getVersionCode(context, PKG_MK_OPPO) >= SUPPORT_MK_VERSION) { return jumpApp(context, Uri.parse(url), PKG_MK_OPPO); } return false; }
private static long getVersionCode(Activity context, String packageName) { long versionCode = -1; try { PackageInfo info = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA); if (info != null) { versionCode = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P ? info.getLongVersionCode() : info.versionCode; } } catch (PackageManager.NameNotFoundException e) { } return versionCode; }
private static boolean jumpApp(Activity context, Uri uri, String targetPkgName) { try { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setPackage(targetPkgName); intent.setData(uri); context.startActivityForResult(intent, 100); return true; } catch (Exception e) { e.printStackTrace(); } return false; }
|
0x02 Vivo应用商店评分
Vivo应用评论调起的官方文档:
https://dev.vivo.com.cn/documentCenter/doc/257
1 2 3 4 5 6
| String url = market: Uri uri = Uri.parse(url); Intent intent= new Intent(Intent.ACTION_VIEW,uri); intent.setPackage("com.bbk.appstore"); startActivity(intent);
|
0x03 其他应用商店
直接跳转到应用商店的APP详情页,具体代码如下:
1 2 3 4 5 6 7
| String url = market: Uri uri = Uri.parse(url); Intent intent= new Intent(Intent.ACTION_VIEW,uri); if (market_pkg != null) intent.setPackage(market_pkg); startActivity(intent);
|