當前位置: 首頁>>代碼示例>>Java>>正文


Java Build.BRAND屬性代碼示例

本文整理匯總了Java中android.os.Build.BRAND屬性的典型用法代碼示例。如果您正苦於以下問題:Java Build.BRAND屬性的具體用法?Java Build.BRAND怎麽用?Java Build.BRAND使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.os.Build的用法示例。


在下文中一共展示了Build.BRAND屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: validateSignature

public boolean validateSignature(Context context, String packageName) {
    String brand = Build.BRAND;
    int applicationFlags = context.getApplicationInfo().flags;
    if (brand.startsWith("generic") &&
            (applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
        // We are debugging on an emulator, don't validate package signature.
        return true;
    }

    PackageInfo packageInfo = null;
    try {
        packageInfo = context.getPackageManager().getPackageInfo(packageName,
                PackageManager.GET_SIGNATURES);
    } catch (PackageManager.NameNotFoundException e) {
        return false;
    }

    for (Signature signature : packageInfo.signatures) {
        String hashedSignature = Utility.sha1hash(signature.toByteArray());
        if (validAppSignatureHashes.contains(hashedSignature)) {
            return true;
        }
    }

    return false;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:26,代碼來源:NativeProtocol.java

示例2: sendFeedback

public static void sendFeedback(Context context) {
    String body = null;
    try {
        body = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
        body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " +
                Build.VERSION.RELEASE + "\n App Version: " + body + "\n Device Brand: " + Build.BRAND +
                "\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER;
    } catch (PackageManager.NameNotFoundException e) {
    }
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("message/rfc822");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
    intent.putExtra(Intent.EXTRA_SUBJECT, "發送自你的安卓設備");
    intent.putExtra(Intent.EXTRA_TEXT, body);
    context.startActivity(Intent.createChooser(intent, context.getString(R.string.choose_email_client)));
}
 
開發者ID:wendyltan,項目名稱:EasyTodo,代碼行數:16,代碼來源:SettingsActivity.java

示例3: deviceInf

public static void deviceInf(Context ctx) {

        String deviceInfo = "Device Info:";
        deviceInfo += "\n Android Version: " + Build.VERSION.RELEASE;
        deviceInfo += "\n OS API Level: " + android.os.Build.VERSION.SDK_INT;
        deviceInfo += "\n OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL + ")";
        deviceInfo += "\n Device: " + android.os.Build.DEVICE;

        deviceInfo += "\n Model (and Product): " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")";
        deviceInfo += "\n Model manufacturer:" + Build.BRAND;
        deviceInfo += "\n Model Hardware:" +Build.HARDWARE;

        PackageInfo pinfo = null;
        try {
            pinfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e1) {
            e1.printStackTrace();
        }

        int versionNumber = pinfo.versionCode;
        String versionName = pinfo.versionName;

        deviceInfo +="\n App Version : " + versionName + versionNumber;
        deviceInfo += "\n Root Status:" +isRooted();

        String locale = ctx.getResources().getConfiguration().locale.getCountry();
        deviceInfo += "\n Country:" + locale;

        Intent email = new Intent(Intent.ACTION_SEND);

        String emailID = emailaddress();
        email.putExtra(Intent.EXTRA_EMAIL, new String[]{emailID});
        email.putExtra(Intent.EXTRA_SUBJECT, ctx.getPackageName() + " Feedback /Bug Report");
        email.setType("message/rfc822");
        email.putExtra(Intent.EXTRA_TEXT, "\n\n\n" + deviceInfo);
        Intent new_intent = Intent.createChooser(email, "Email Via...");
        new_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        ctx.startActivity(new_intent);

    }
 
開發者ID:kanishqgupta,項目名稱:FeedbackerLib,代碼行數:40,代碼來源:feedbacker.java

示例4: validateSignature

public boolean validateSignature(Context context, String packageName) {
    String brand = Build.BRAND;
    int applicationFlags = context.getApplicationInfo().flags;
    if (brand.startsWith("generic") && (applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
        // We are debugging on an emulator, don't validate package signature.
        return true;
    }

    PackageInfo packageInfo = null;
    try {
        packageInfo = context.getPackageManager().getPackageInfo(packageName,
                PackageManager.GET_SIGNATURES);
    } catch (PackageManager.NameNotFoundException e) {
        return false;
    }

    for (Signature signature : packageInfo.signatures) {
        String hashedSignature = Utility.sha1hash(signature.toByteArray());
        if (validAppSignatureHashes.contains(hashedSignature)) {
            return true;
        }
    }

    return false;
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:25,代碼來源:NativeProtocol.java

示例5: getHandSetInfo

private static String getHandSetInfo() {
    String handSetInfo = "手機型號:" + Build.MODEL
            + "\n係統版本:" + Build.VERSION.RELEASE
            + "\n產品型號:" + Build.PRODUCT
            + "\n版本顯示:" + Build.DISPLAY
            + "\n係統定製商:" + Build.BRAND
            + "\n設備參數:" + Build.DEVICE
            + "\n開發代號:" + Build.VERSION.CODENAME
            + "\nSDK版本號:" + Build.VERSION.SDK_INT
            + "\nCPU類型:" + Build.CPU_ABI
            + "\n硬件類型:" + Build.HARDWARE
            + "\n主機:" + Build.HOST
            + "\n生產ID:" + Build.ID
            + "\nROM製造商:" + Build.MANUFACTURER // 這行返回的是rom定製商的名稱
            ;
    Log.e("tt",handSetInfo);
    return handSetInfo;
}
 
開發者ID:hss01248,項目名稱:MainActivityUIUtil,代碼行數:18,代碼來源:StatusbarUtil.java

示例6: getDeviceListing

/**
 *
 * @return all involved Build.* parameters and its values
 */
public static String getDeviceListing() {
    return "Build.PRODUCT: " + Build.PRODUCT + "\n" +
            "Build.MANUFACTURER: " + Build.MANUFACTURER + "\n" +
            "Build.BRAND: " + Build.BRAND + "\n" +
            "Build.DEVICE: " + Build.DEVICE + "\n" +
            "Build.MODEL: " + Build.MODEL + "\n" +
            "Build.HARDWARE: " + Build.HARDWARE + "\n" +
            "Build.FINGERPRINT: " + Build.FINGERPRINT + "\n" +
            "Build.CPU_ABI: " + Build.CPU_ABI + "\n" +
            "Build.CPU_ABI2: " + Build.CPU_ABI2 + "\n" +
            "Build.HOST: " + Build.HOST;
}
 
開發者ID:zhuangzaiku,項目名稱:AndroidCollection,代碼行數:16,代碼來源:EmulatorDetector.java

示例7: convert

public static String convert(@NonNull String requestId) {
    SpeechConfig message = new SpeechConfig();

    System system = new System();
    // This sample does not use Speech SDK, but this value is needed, so set fixed value;
    system.version = "2.0.12341";

    Os os = new Os();
    os.platform = "Android";
    os.name = Build.VERSION.CODENAME;
    os.version = String.valueOf(Build.VERSION.SDK_INT);

    Device device = new Device();
    device.manufacturer = Build.BRAND;
    device.model = Build.DEVICE;
    device.version = Build.VERSION.RELEASE;

    message.context.system = system;
    message.os = os;
    message.device = device;

    String json = JsonMapper.toJson(message);

    return PATH.getValue() + ": " + SPEECH_CONFIG.getValue() + CRLF.getValue() +
            X_REQUEST_ID.getValue() + ": " + requestId + CRLF.getValue() +
            X_TIMESTAMP.getValue() + ": " + CurrentTime.newTime() + CRLF.getValue() +
            CONTENT_TYPE.getValue() + ": " + APPLICATION_JSON.getValue() + CRLF.getValue() + CRLF.getValue() + json;
}
 
開發者ID:lakeel-altla,項目名稱:samples-cognitive-services-android,代碼行數:28,代碼來源:SpeechConfigConverter.java

示例8: getDeviceInfo

/**
 * 獲取設備信息
 */
public String getDeviceInfo(Context context) {
    return getEmulatorName(context) + "\n" + "Build.PRODUCT: " + Build.PRODUCT + "\n" +
            "Build.MANUFACTURER: " + Build.MANUFACTURER + "\n" +
            "Build.BRAND: " + Build.BRAND + "\n" +
            "Build.DEVICE: " + Build.DEVICE + "\n" +
            "Build.MODEL: " + Build.MODEL + "\n" +
            "Build.HARDWARE: " + Build.HARDWARE + "\n" +
            "Build.FINGERPRINT: " + Build.FINGERPRINT;
}
 
開發者ID:CodyyAndroid,項目名稱:EmulatorDetect,代碼行數:12,代碼來源:EmulatorDetectorService.java

示例9: getBrandName

public static String getBrandName() {
    String brand = Build.BRAND;
    log(TAG, "get brandName:" + brand);
    if (brand == null || brand.length() <= 0) {
        return "";
    }
    return brand;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:8,代碼來源:DataUtils.java

示例10: getBrandName

public static String getBrandName() {
    String brand = Build.BRAND;
    if (brand == null || brand.length() <= 0) {
        return "";
    }
    return brand;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:7,代碼來源:LetvUtil.java

示例11: leakInfo

public static String leakInfo(Context context, HeapDump heapDump, AnalysisResult result,
                              boolean detailed) {
    PackageManager packageManager = context.getPackageManager();
    String packageName = context.getPackageName();
    try {
        PackageInfo packageInfo = packageManager.getPackageInfo(packageName, 0);
        String info = "In " + packageName + ":" + packageInfo.versionName + ":" + packageInfo
                .versionCode + ".\n";
        String detailedString = "";
        if (result.leakFound) {
            if (result.excludedLeak) {
                info = info + "* LEAK CAN BE IGNORED.\n";
            }
            info = info + "* " + result.className;
            if (!heapDump.referenceName.equals("")) {
                info = info + " (" + heapDump.referenceName + SocializeConstants.OP_CLOSE_PAREN;
            }
            info = info + " has leaked:\n" + result.leakTrace.toString() + "\n";
            if (detailed) {
                detailedString = "\n* Details:\n" + result.leakTrace.toDetailedString();
            }
        } else {
            info = result.failure != null ? info + "* FAILURE:\n" + Log.getStackTraceString
                    (result.failure) + "\n" : info + "* NO LEAK FOUND.\n\n";
        }
        return info + "* Reference Key: " + heapDump.referenceKey + "\n" + "* Device: " +
                Build.MANUFACTURER + " " + Build.BRAND + " " + Build.MODEL + " " + Build
                .PRODUCT + "\n" + "* Android Version: " + VERSION.RELEASE + " API: " +
                VERSION.SDK_INT + " LeakCanary: " + BuildConfig.LIBRARY_VERSION + "\n" + "* " +
                "Durations: watch=" + heapDump.watchDurationMs + "ms, gc=" + heapDump
                .gcDurationMs + "ms, heap dump=" + heapDump.heapDumpDurationMs + "ms, " +
                "analysis=" + result.analysisDurationMs + "ms" + "\n" + detailedString;
    } catch (NameNotFoundException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:36,代碼來源:LeakCanary.java

示例12: getBrand

public static String getBrand() {
  return Build.BRAND;
}
 
開發者ID:lgyjg,項目名稱:AndroidRTC,代碼行數:3,代碼來源:BuildInfo.java

示例13: makeUA

public static String makeUA() {
    final String ua = Build.BRAND + "/" + Build.MODEL + "/" + Build.VERSION.RELEASE;
    return ua;
}
 
開發者ID:Horrarndoo,項目名稱:YiZhi,代碼行數:4,代碼來源:HttpUtils.java

示例14: getBrand

@CalledByNative
public static String getBrand() {
    return Build.BRAND;
}
 
開發者ID:lizhangqu,項目名稱:chromium-net-for-android,代碼行數:4,代碼來源:BuildInfo.java

示例15: h

public static String h() {
    return Build.BRAND;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:3,代碼來源:DeviceInfoUtils.java


注:本文中的android.os.Build.BRAND屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。