Example usage for android.os Build FINGERPRINT

List of usage examples for android.os Build FINGERPRINT

Introduction

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

Prototype

String FINGERPRINT

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

Click Source Link

Document

A string that uniquely identifies this build.

Usage

From source file:ua.naiksoftware.chars.Sender.java

/**
 *
 * @param <b>p</b> score and time
 * @return true if ok, else false//from   w  w w. ja  va  2  s . c o m
 */
@Override
protected Boolean doInBackground(Integer... p) {
    Log.d(tag, "doInBacckground begin");
    int score = p[0];
    int time = p[1];
    String model = Build.MANUFACTURER + " " + Build.MODEL;
    String devId = Build.FINGERPRINT;
    if (model == null || model.equals("")) {
        model = "Unknown";
    }
    Log.d(tag, "doInBackground: data set: devId=" + (devId == null ? "null" : devId));
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost(URL.replace("game", "chars"));
    Log.d(tag, "doInBackground: httppost created");

    HttpResponse response = null;
    try {
        // Add my data
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(7);
        nameValuePairs.add(new BasicNameValuePair("score", String.valueOf(score)));
        nameValuePairs.add(new BasicNameValuePair("time", String.valueOf(time)));
        nameValuePairs.add(new BasicNameValuePair("l", MainActivity.login));
        nameValuePairs.add(new BasicNameValuePair("p", MainActivity.pass));
        nameValuePairs.add(new BasicNameValuePair("model", model));
        nameValuePairs.add(new BasicNameValuePair("devid", devId));
        nameValuePairs.add(new BasicNameValuePair("valid",
                md5(MainActivity.login + MainActivity.pass + MainActivity.login.length())));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        Log.d(tag, "doInBackground: form set, pre execute httpclient");
        // Execute HTTP Post Request
        response = httpclient.execute(httppost);
        Log.d(tag, "doInBackground: executed httpclient");

    } catch (ClientProtocolException e) {
        Log.e(tag, "doInBackground: protocol exception", e);
        err = e.getMessage().replace("eof-cms.h2m.ru", "annimon.com");// security :)
        return false;
    } catch (IOException e) {
        Log.d(tag, "doInBackground: IOException", e);
        err = e.getMessage().replace("eof-cms.h2m.ru", "annimon.com");// security :)
        return false;
    }
    Log.d(tag, "doInBackground: all right (end)");
    return true;
}

From source file:io.digibyte.tools.util.Utils.java

public static boolean isEmulatorOrDebug(Context app) {
    String fing = Build.FINGERPRINT;
    boolean isEmulator = false;
    if (fing != null) {
        isEmulator = fing.contains("vbox") || fing.contains("generic");
    }/*w ww  . ja  v  a  2 s  . c o  m*/
    return isEmulator || (0 != (app.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
}

From source file:com.android.dialer.lookup.google.GoogleForwardLookup.java

public GoogleForwardLookup(Context context) {
    StringBuilder sb = new StringBuilder("GoogleDialer ");
    try {/*  ww w. j  a v  a 2  s. c  om*/
        sb.append(context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName);
        sb.append(" ");
        sb.append(Build.FINGERPRINT);
        mUserAgent = sb.toString();
    } catch (PackageManager.NameNotFoundException e) {
    }
}

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();/*  ww w .j  av a 2  s  . c om*/

    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.fallahpoor.infocenter.fragments.GeneralFragment.java

private ArrayList<String> getSubItemsArrayList() {

    return new ArrayList<>(Arrays.asList(new String[] { Build.MANUFACTURER, Build.BRAND, Build.DEVICE,
            Build.BOOTLOADER, Build.DISPLAY, Build.FINGERPRINT, getDeviceID(), Build.SERIAL,
            getRadioFirmwareVersion(), getFormattedUptime() }));

}

From source file:altermarkive.uploader.Report.java

private static JSONObject reportDevice(Context context) throws JSONException {
    JSONObject device = new JSONObject();
    device.put("id", hash(id(context)));
    device.put("manufacturer", Build.MANUFACTURER);
    device.put("brand", Build.BRAND);
    device.put("product", Build.PRODUCT);
    device.put("model", Build.MODEL);
    device.put("design", Build.DEVICE);
    device.put("board", Build.BOARD);
    device.put("hardware", Build.HARDWARE);
    device.put("build", Build.FINGERPRINT);
    return device;
}

From source file:jp.ne.sakura.kkkon.android.exceptionhandler.DefaultUploaderWeb.java

public static void upload(final Context context, final File file, final String url) {
    terminate();// w ww  .j ava  2 s .c  om

    thread = new Thread(new Runnable() {

        @Override
        public void run() {
            Log.d(TAG, "upload thread tid=" + android.os.Process.myTid());
            try {
                //$(BRAND)/$(PRODUCT)/$(DEVICE)/$(BOARD):$(VERSION.RELEASE)/$(ID)/$(VERSION.INCREMENTAL):$(TYPE)/$(TAGS)
                Log.d(TAG, "fng=" + Build.FINGERPRINT);
                final List<NameValuePair> list = new ArrayList<NameValuePair>(16);
                list.add(new BasicNameValuePair("fng", Build.FINGERPRINT));

                HttpPost httpPost = new HttpPost(url);
                //httpPost.getParams().setParameter( CoreConnectionPNames.SO_TIMEOUT, new Integer(5*1000) );
                httpPost.setEntity(new UrlEncodedFormEntity(list, HTTP.UTF_8));
                DefaultHttpClient httpClient = new DefaultHttpClient();
                Log.d(TAG, "socket.timeout="
                        + httpClient.getParams().getIntParameter(CoreConnectionPNames.SO_TIMEOUT, -1));
                Log.d(TAG, "connection.timeout="
                        + httpClient.getParams().getIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, -1));
                httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, new Integer(5 * 1000));
                httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
                        new Integer(5 * 1000));
                Log.d(TAG, "socket.timeout="
                        + httpClient.getParams().getIntParameter(CoreConnectionPNames.SO_TIMEOUT, -1));
                Log.d(TAG, "connection.timeout="
                        + httpClient.getParams().getIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, -1));
                // <uses-permission android:name="android.permission.INTERNET"/>
                // got android.os.NetworkOnMainThreadException, run at UI Main Thread
                HttpResponse response = httpClient.execute(httpPost);
                Log.d(TAG, "response=" + response.getStatusLine().getStatusCode());
            } catch (Exception e) {
                Log.d(TAG, "got Exception. msg=" + e.getMessage(), e);
            } finally {
                ExceptionHandler.clearReport();
            }
            Log.d(TAG, "upload finish");
        }
    });
    thread.setName("upload crash");

    thread.start();
    if (USE_DIALOG) {
        final AlertDialog.Builder alertDialogBuilder = setupAlertDialog(context);
        if (null != alertDialogBuilder) {
            alertDialogBuilder.setCancelable(false);

            final AlertDialog alertDialog = alertDialogBuilder.show();

            /*
            while ( thread.isAlive() )
            {
            Log.d( TAG, "thread tid=" + android.os.Process.myTid() + ",state=" + thread.getState() );
            if ( ! thread.isAlive() )
            {
                break;
            }
                    
            {
                try
                {
                    Thread.sleep( 1 * 1000 );
                }
                catch ( InterruptedException e )
                {
                    Log.d( TAG, "got exception", e );
                }
            }
                    
            if ( null != alertDialog )
            {
                if ( alertDialog.isShowing() )
                {
                }
                else
                {
                    if ( ! thread.isAlive() )
                    {
                        break;
                    }
                    alertDialog.show();
                }
            }
                    
            if ( ! Thread.State.RUNNABLE.equals(thread.getState()) )
            {
                break;
            }
                    
            }
                    
            if ( null != alertDialog )
            {
            alertDialog.dismiss();
            }
            */
        }

        try {
            thread.join(); // must call. leak handle...
            thread = null;
        } catch (InterruptedException e) {
            Log.d(TAG, "got Exception", e);
        }
    }

}

From source file:com.error.hunter.ListenService.java

private void generateBugReport(ActivityManager.ProcessErrorStateInfo entry) {

    String condition;/*from www  .  jav  a 2  s. c  o m*/
    badProcess = entry.processName;
    String build = Build.DISPLAY;
    String fingerprint = Build.FINGERPRINT;
    String serial = Build.SERIAL;
    String product = Build.PRODUCT;
    String model = Build.MODEL;

    File path = Environment.getDataDirectory();
    StatFs stat = new StatFs(path.getPath());
    @SuppressWarnings("deprecation")
    long blockSize = stat.getBlockSize();
    @SuppressWarnings("deprecation")
    long availableBlocks = stat.getAvailableBlocks();
    String memory = Formatter.formatFileSize(this, availableBlocks * blockSize).toString();

    MemoryInfo mi = new MemoryInfo();
    ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    activityManager.getMemoryInfo(mi);
    long availableMegs = mi.availMem / 1048576L;

    strBuf.append("Problem detected in: ").append(badProcess);
    if (entry.tag != null) {
        strBuf.append(" (").append(entry.tag).append(")");
    }
    strBuf.append("\nDevice product: " + product);
    strBuf.append("\nDevice model: " + model);
    strBuf.append("\nDevice build: " + build);
    strBuf.append("\nDevice fingerprint: " + fingerprint);
    strBuf.append("\nDevice SN: " + serial);
    strBuf.append("\nDevice available RAM (MB): " + availableMegs);
    strBuf.append("\nDevice free phisical memory: " + memory + "\n");
    strBuf.append(getNetworkInfo());
    strBuf.append("\n");

    ActivityManager actvityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
    List<ActivityManager.RunningServiceInfo> procInfos = actvityManager.getRunningServices(1000);
    Iterator<RunningServiceInfo> taskIter = procInfos.iterator();
    RunningServiceInfo info;
    while (taskIter.hasNext()) {
        info = taskIter.next();
        if (info.process.equals(badProcess)) {
            strBuf.append("\nService " + info.service + " crash count: " + info.crashCount + " active since: "
                    + info.activeSince + " process: " + info.process);
        }
    }
    strBuf.append("\n");
    //android.os.Debug.MemoryInfo[] miPid = activityManager.getProcessMemoryInfo(new int[]{entry.pid}); 
    //String memoryProc = miPid[0].toString();
    //strBuf.append("\nRAM used by process (Process: " + entry.processName + " PID: " + entry.pid +"): " + memoryProc + "MB\n");

    switch (entry.condition) {

    case ActivityManager.ProcessErrorStateInfo.CRASHED:
        condition = "CRASHED";
        getDeviceProcessInfo(badProcess, entry.stackTrace);
        writeLogsToFile(condition, badProcess);
        break;
    case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING:
        condition = "ANR";
        getDeviceProcessInfo(badProcess, "");
        writeLogsToFile(condition, badProcess);
        break;
    default:
        condition = "<unknown>";
        getDeviceProcessInfo(badProcess, entry.stackTrace);
        writeLogsToFile(condition, badProcess);
        break;
    }
}

From source file:de.schildbach.wallet.util.CrashReporter.java

public static void appendDeviceInfo(final Appendable report, final Context context) throws IOException {
    final Resources res = context.getResources();
    final android.content.res.Configuration config = res.getConfiguration();
    final ActivityManager activityManager = (ActivityManager) context
            .getSystemService(Context.ACTIVITY_SERVICE);
    final DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
            .getSystemService(Context.DEVICE_POLICY_SERVICE);

    report.append("Device Model: " + Build.MODEL + "\n");
    report.append("Android Version: " + Build.VERSION.RELEASE + "\n");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
        report.append("Android security patch level: ").append(Build.VERSION.SECURITY_PATCH).append("\n");
    report.append("ABIs: ").append(Joiner.on(", ").skipNulls().join(Strings.emptyToNull(Build.CPU_ABI),
            Strings.emptyToNull(Build.CPU_ABI2))).append("\n");
    report.append("Board: " + Build.BOARD + "\n");
    report.append("Brand: " + Build.BRAND + "\n");
    report.append("Device: " + Build.DEVICE + "\n");
    report.append("Display: " + Build.DISPLAY + "\n");
    report.append("Finger Print: " + Build.FINGERPRINT + "\n");
    report.append("Host: " + Build.HOST + "\n");
    report.append("ID: " + Build.ID + "\n");
    report.append("Product: " + Build.PRODUCT + "\n");
    report.append("Tags: " + Build.TAGS + "\n");
    report.append("Time: " + Build.TIME + "\n");
    report.append("Type: " + Build.TYPE + "\n");
    report.append("User: " + Build.USER + "\n");
    report.append("Configuration: " + config + "\n");
    report.append("Screen Layout: size "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK) + " long "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_LONG_MASK) + "\n");
    report.append("Display Metrics: " + res.getDisplayMetrics() + "\n");
    report.append("Memory Class: " + activityManager.getMemoryClass() + "/"
            + activityManager.getLargeMemoryClass()
            + (ActivityManagerCompat.isLowRamDevice(activityManager) ? " (low RAM device)" : "") + "\n");
    report.append("Storage Encryption Status: " + devicePolicyManager.getStorageEncryptionStatus() + "\n");
    report.append("Bluetooth MAC: " + bluetoothMac() + "\n");
    report.append("Runtime: ").append(System.getProperty("java.vm.name")).append(" ")
            .append(System.getProperty("java.vm.version")).append("\n");
}

From source file:org.cook_e.cook_e.BugReportActivity.java

/**
 * Gathers information about the device running the application and returns it as a JSONObject
 * @return information about the system//from   w w w .j  a v  a2  s . co m
 */
private JSONObject getSystemInformation() {
    final JSONObject json = new JSONObject();

    try {
        final JSONObject build = new JSONObject();
        build.put("version_name", BuildConfig.VERSION_NAME);
        build.put("version_code", BuildConfig.VERSION_CODE);
        build.put("build_type", BuildConfig.BUILD_TYPE);
        build.put("debug", BuildConfig.DEBUG);

        json.put("build", build);

        final JSONObject device = new JSONObject();
        device.put("board", Build.BOARD);
        device.put("bootloader", Build.BOOTLOADER);
        device.put("brand", Build.BRAND);
        device.put("device", Build.DEVICE);
        device.put("display", Build.DISPLAY);
        device.put("fingerprint", Build.FINGERPRINT);
        device.put("hardware", Build.HARDWARE);
        device.put("host", Build.HOST);
        device.put("id", Build.ID);
        device.put("manufacturer", Build.MANUFACTURER);
        device.put("model", Build.MODEL);
        device.put("product", Build.PRODUCT);
        device.put("radio", Build.getRadioVersion());
        device.put("serial", Build.SERIAL);
        device.put("tags", Build.TAGS);
        device.put("time", Build.TIME);
        device.put("type", Build.TYPE);
        device.put("user", Build.USER);

        json.put("device", device);
    } catch (JSONException e) {
        // Ignore
    }

    return json;
}