Example usage for android.os Build PRODUCT

List of usage examples for android.os Build PRODUCT

Introduction

In this page you can find the example usage for android.os Build PRODUCT.

Prototype

String PRODUCT

To view the source code for android.os Build PRODUCT.

Click Source Link

Document

The name of the overall product.

Usage

From source file:Main.java

/**
 * Check if this app is running in Emulator.
 * /*from  w  w w  .  j  a  va 2  s . c o m*/
 * For ChBoSync: Implementation of this method replaced (because the old one did not recognize
 * the GenyMotion Emulator) and moved it here from class {@link de.chbosync.android.syncmlclient.AppInitializer}.
 * 
 * In contrast to the above method <tt>isSimulator(Context)</tt>, this method
 * does <i>NOT</i> require a reference to the context object (having this method in
 * class <tt>AndroidUtils</tt> seems to be more suitable for the reusability of this method).
 * 
 * For testing you can display a toast saying that the app is running in an emulator at the end
 * of method {@link de.chbosync.android.syncmlclient.activities.AndroidAboutScreen#onCreate(Bundle)}.
 * 
 * 
 * @return <tt>true</tt> if this app is running in an Emulator, <tt>false</tt> if this app is running on a real device.
 */
public static boolean isAndroidEmulator() {

    String overallProduct = Build.PRODUCT;

    boolean result = overallProduct.equals("google_sdk") || overallProduct.equals("sdk")
            || overallProduct.equals("sdk_x86") || overallProduct.equals("vbox86p");

    return result;
}

From source file:com.huguesjohnson.segacdcollector.EbayUtils.java

public EbayUtils(Context context) {
    this.dateFormat = new SimpleDateFormat("[\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\"]");
    this.resources = context.getResources();
    requestTemplate = this.resources.getString(R.string.ebay_request_template);
    if (Build.PRODUCT.toLowerCase().indexOf("sdk") > -1) {
        /* //from  w w w. jav a 2s  .c o m
        the sandbox URLs are pretty useless as they only return a success code but no results
        appID=this.resources.getString(R.string.ebay_appid_sandbox);
        ebayURL=this.resources.getString(R.string.ebay_wsurl_sandbox);
        */
        appID = this.resources.getString(R.string.ebay_appid_production);
        ebayURL = this.resources.getString(R.string.ebay_wsurl_production);
    } else {
        appID = this.resources.getString(R.string.ebay_appid_production);
        ebayURL = this.resources.getString(R.string.ebay_wsurl_production);
    }
}

From source file:com.ntsync.android.sync.client.MyHttpClient.java

private String getUserAgent(Context context, String defaultHttpClientUserAgent) {
    String versionName = SystemHelper.getPkgVersion(context);
    StringBuilder ret = new StringBuilder();
    ret.append("NTsync");
    ret.append("/");
    ret.append(versionName);/*from ww w.  j ava2 s .c om*/
    ret.append(" (");
    ret.append("Linux; U; Android ");
    ret.append(Build.VERSION.RELEASE);
    ret.append("; ");
    ret.append(Locale.getDefault());
    ret.append("; ");
    ret.append(Build.PRODUCT);
    ret.append(")");
    if (defaultHttpClientUserAgent != null) {
        ret.append(" ");
        ret.append(defaultHttpClientUserAgent);
    }
    return ret.toString();
}

From source file:com.huguesjohnson.sega32xcollector.ebay.EbayUtils.java

public EbayUtils(Context context) {
    this.dateFormat = new SimpleDateFormat("[\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\"]");
    this.resources = context.getResources();
    if (Build.PRODUCT.toLowerCase().indexOf("sdk") > -1) {
        /* /*from   w  ww.j  a  v a2 s  .  co  m*/
        the sandbox URLs are pretty useless as they only return a success code but no results
        appID=this.resources.getString(R.string.ebay_appid_sandbox);
        ebayURL=this.resources.getString(R.string.ebay_wsurl_sandbox);
        */
        appID = this.resources.getString(R.string.ebay_appid_production);
        ebayURL = this.resources.getString(R.string.ebay_wsurl_production);
    } else {
        appID = this.resources.getString(R.string.ebay_appid_production);
        ebayURL = this.resources.getString(R.string.ebay_wsurl_production);
    }
}

From source file:com.anysoftkeyboard.ui.dev.DeveloperUtils.java

public static String getSysInfo(@Nullable Context context) {
    StringBuilder sb = new StringBuilder();
    sb.append("BRAND:").append(Build.BRAND).append(NEW_LINE);
    sb.append("DEVICE:").append(Build.DEVICE).append(NEW_LINE);
    sb.append("Build ID:").append(Build.DISPLAY).append(NEW_LINE);
    sb.append("changelist number:").append(Build.ID).append("\n");
    sb.append("MODEL:").append(Build.MODEL).append(NEW_LINE);
    sb.append("PRODUCT:").append(Build.PRODUCT).append(NEW_LINE);
    sb.append("TAGS:").append(Build.TAGS).append(NEW_LINE);
    sb.append("VERSION.INCREMENTAL:").append(Build.VERSION.INCREMENTAL).append(NEW_LINE);
    sb.append("VERSION.RELEASE:").append(Build.VERSION.RELEASE).append(NEW_LINE);
    sb.append("VERSION.SDK_INT:").append(Build.VERSION.SDK_INT).append(NEW_LINE);
    if (context != null && context.getResources() != null
            && context.getResources().getConfiguration() != null) {
        Configuration configuration = context.getResources().getConfiguration();
        sb.append("Locale:").append(configuration.locale).append(NEW_LINE);
        sb.append("configuration:").append(configuration.toString()).append(NEW_LINE);
    }/*from  w w w . j  av  a  2 s  . com*/

    sb.append("That's all I know.");
    return sb.toString();
}

From source file:org.LK8000.LK8000.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (serviceClass == null)
        serviceClass = MyService.class;

    super.onCreate(savedInstanceState);
    //    Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());

    Fabric fabric = new Fabric.Builder(this).debuggable(true).kits(new Crashlytics(), new CrashlyticsNdk())
            .build();//from w  w  w . j av  a2s .c o  m

    Fabric.with(fabric);

    Log.d(TAG, "ABI=" + Build.CPU_ABI);
    Log.d(TAG, "PRODUCT=" + Build.PRODUCT);
    Log.d(TAG, "MANUFACTURER=" + Build.MANUFACTURER);
    Log.d(TAG, "MODEL=" + Build.MODEL);
    Log.d(TAG, "DEVICE=" + Build.DEVICE);
    Log.d(TAG, "BOARD=" + Build.BOARD);
    Log.d(TAG, "FINGERPRINT=" + Build.FINGERPRINT);

    if (!Loader.loaded) {
        TextView tv = new TextView(this);
        tv.setText("Failed to load the native LK8000 libary.\n"
                + "Report this problem to us, and include the following information:\n" + "ABI=" + Build.CPU_ABI
                + "\n" + "PRODUCT=" + Build.PRODUCT + "\n" + "FINGERPRINT=" + Build.FINGERPRINT + "\n"
                + "error=" + Loader.error);
        setContentView(tv);
        return;
    }

    initialiseNative();

    NetUtil.initialise(this);
    InternalGPS.Initialize();
    NonGPSSensors.Initialize();

    IOIOHelper.onCreateContext(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR)
        // Bluetooth suppoert was added in Android 2.0 "Eclair"
        BluetoothHelper.Initialize(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
        // the DownloadManager was added in Android 2.3 "Gingerbread"
        DownloadUtil.Initialise(getApplicationContext());

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
        UsbSerialHelper.Initialise(this);
    }

    SoundUtil.Initialise();

    // fullscreen mode
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().addFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    /* Workaround for layout problems in Android KitKat with immersive full
       screen mode: Sometimes the content view was not initialized with the
       correct size, which caused graphics artifacts. */
    if (android.os.Build.VERSION.SDK_INT >= 19) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
                | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
                | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    }

    enableImmersiveModeIfSupported();

    TextView tv = new TextView(this);
    tv.setText("Loading LK8000...");
    setContentView(tv);

    batteryReceiver = new BatteryReceiver();
    registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));

    SharedPreferences settings = getSharedPreferences("LK8000", 0);
    int screenOrientation = settings.getInt("screenOrientation", 0);
    switch (screenOrientation) {
    case 0:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
        break;
    case 1:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;
    case 2:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        break;
    case 3:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
        break;
    case 4:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
        break;
    default:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

}

From source file:com.scvngr.levelup.core.net.RequestUtils.java

/**
 * Returns a {@link String} representation to use as the User-Agent string when communicating
 * with the server. A sample string looks like:
 * <p/>//from w ww.j  av  a 2  s  .c  om
 * "LevelUp/2.3.12 (Linux; U; Android; 1.0; generic_x86/sd_x86; en-US;) LevelUpSdk/0.0.1".
 *
 * @param context Application context.
 * @return the user agent value.
 */
@NonNull
public static String getUserAgent(@NonNull final Context context) {
    return NullUtils.format("%s (Linux; U; Android %s; %s/%s; %s) %s", getUserAgentAppVersionString(context),
            Build.VERSION.RELEASE, Build.BRAND, Build.PRODUCT, Locale.getDefault().toString(),
            getUserAgentSdkVersionString(context));
}

From source file:at.amartinz.hardware.device.Device.java

protected Device(@NonNull Context context) {
    mContext = context;//from  www .  j  av  a2 s .  co m

    platformVersion = Build.VERSION.RELEASE;
    platformId = Build.DISPLAY;
    platformType = Build.VERSION.CODENAME + " " + Build.TYPE;
    platformTags = Build.TAGS;
    platformBuildType = HwUtils.getDate(Build.TIME);

    vmVersion = System.getProperty("java.vm.version", "-");
    vmLibrary = getRuntime();

    final Resources res = context.getResources();
    screenWidth = res.getDisplayMetrics().widthPixels;
    screenHeight = res.getDisplayMetrics().heightPixels;

    androidId = getAndroidId(context);
    manufacturer = Build.MANUFACTURER;
    model = Build.MODEL;
    device = Build.DEVICE;
    product = Build.PRODUCT;
    board = Build.BOARD;
    bootloader = Build.BOOTLOADER;
    radio = Build.getRadioVersion();

    // initialize defaults
    hasBusyBox = false;
    hasRoot = false;
    suVersion = "-";
    isSELinuxEnforcing = isSELinuxEnforcing(); // ehm, alright, if you say so...
}

From source file:com.piusvelte.sonet.core.SonetHttpClient.java

protected static DefaultHttpClient getThreadSafeClient(Context context) {
    if (sHttpClient == null) {
        Log.d(TAG, "create http client");
        SocketFactory sf;/*from  ww w  .  j  a  v a  2 s  .c o m*/
        try {
            Class<?> sslSessionCacheClass = Class.forName("android.net.SSLSessionCache");
            Object sslSessionCache = sslSessionCacheClass.getConstructor(Context.class).newInstance(context);
            Method getHttpSocketFactory = Class.forName("android.net.SSLCertificateSocketFactory")
                    .getMethod("getHttpSocketFactory", new Class<?>[] { int.class, sslSessionCacheClass });
            sf = (SocketFactory) getHttpSocketFactory.invoke(null, CONNECTION_TIMEOUT, sslSessionCache);
        } catch (Exception e) {
            Log.e("HttpClientProvider",
                    "Unable to use android.net.SSLCertificateSocketFactory to get a SSL session caching socket factory, falling back to a non-caching socket factory",
                    e);
            sf = SSLSocketFactory.getSocketFactory();
        }
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        registry.register(new Scheme("https", sf, 443));
        HttpParams params = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(params, CONNECTION_TIMEOUT);
        HttpConnectionParams.setSoTimeout(params, SO_TIMEOUT);
        String versionName;
        try {
            versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
        } catch (NameNotFoundException e) {
            throw new RuntimeException(e);
        }
        StringBuilder userAgent = new StringBuilder();
        userAgent.append(context.getPackageName());
        userAgent.append("/");
        userAgent.append(versionName);
        userAgent.append(" (");
        userAgent.append("Linux; U; Android ");
        userAgent.append(Build.VERSION.RELEASE);
        userAgent.append("; ");
        userAgent.append(Locale.getDefault());
        userAgent.append("; ");
        userAgent.append(Build.PRODUCT);
        userAgent.append(")");
        if (HttpProtocolParams.getUserAgent(params) != null) {
            userAgent.append(" ");
            userAgent.append(HttpProtocolParams.getUserAgent(params));
        }
        HttpProtocolParams.setUserAgent(params, userAgent.toString());
        sHttpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(params, registry), params);
    }
    return sHttpClient;
}

From source file:info.martinmarinov.dvbdriver.ExceptionDialog.java

private String getConstants() {
    StringBuilder res = new StringBuilder();

    res.append("Last Device: ").append(lastDeviceDebugString).append('\n');
    res.append("Build.MANUFACTURER: ").append(Build.MANUFACTURER).append('\n');
    res.append("Build.MODEL: ").append(Build.MODEL).append('\n');
    res.append("Build.PRODUCT: ").append(Build.PRODUCT).append('\n');
    res.append("Build.VERSION.SDK_INT: ").append(Build.VERSION.SDK_INT).append('\n');
    res.append("Build.VERSION.RELEASE: ").append(Build.VERSION.RELEASE).append('\n');

    try {/*from   w  w  w .j av a  2 s .  c  o m*/
        PackageInfo packageInfo = getContext().getPackageManager().getPackageInfo(getContext().getPackageName(),
                0);
        res.append("Driver versionName: ").append(packageInfo.versionName).append('\n');
        res.append("Driver versionCode: ").append(packageInfo.versionCode).append('\n');
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    return res.toString();
}