导航菜单

页面标题

页面副标题

Jurassic World v1.83.4 - AppStoreUtils.java 源代码

正在查看: Jurassic World v1.83.4 应用的 AppStoreUtils.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.urbanairship.util;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import com.urbanairship.AirshipConfigOptions;
import com.urbanairship.google.PlayServicesUtils;

public final class AppStoreUtils {
    private static final String AMAZON_URL = "amzn://apps/android?p=";
    private static final String PLAY_STORE_APP_URL = "https://play.google.com/store/apps/details?id=";
    private static final String PLAY_STORE_PACKAGE = "com.android.vending";
    private static final String PLAY_STORE_URL = "https://play.google.com/store";

    private AppStoreUtils() {
    }

    public static Intent getAppStoreIntent(Context context, int platform, AirshipConfigOptions configOptions) {
        if (configOptions.appStoreUri != null) {
            Intent intent = new Intent("android.intent.action.VIEW", configOptions.appStoreUri);
            if (configOptions.appStoreUri.toString().startsWith(PLAY_STORE_URL) && isPlayStoreAvailable(context)) {
                intent.setPackage("com.android.vending");
            }
            return intent;
        }
        String packageName = context.getPackageName();
        if (platform == 1) {
            return new Intent("android.intent.action.VIEW", Uri.parse(AMAZON_URL + packageName));
        }
        Intent intent2 = new Intent("android.intent.action.VIEW", Uri.parse(PLAY_STORE_APP_URL + packageName));
        if (isPlayStoreAvailable(context)) {
            intent2.setPackage("com.android.vending");
        }
        return intent2;
    }

    private static boolean isPlayStoreAvailable(Context context) {
        return PlayServicesUtils.isGooglePlayStoreAvailable(context.getApplicationContext());
    }
}