Example usage for android.os Build MANUFACTURER

List of usage examples for android.os Build MANUFACTURER

Introduction

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

Prototype

String MANUFACTURER

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

Click Source Link

Document

The manufacturer of the product/hardware.

Usage

From source file:com.activiti.android.platform.intent.IntentUtils.java

public static boolean actionSendFeedbackEmail(Fragment fr) {
    try {//ww  w .j  a  v a  2s  .c o m
        ShareCompat.IntentBuilder iBuilder = ShareCompat.IntentBuilder.from(fr.getActivity());
        Context context = fr.getContext();
        // Email
        iBuilder.addEmailTo(context.getResources().getStringArray(R.array.bugreport_email));

        // Prepare Subject
        String versionName = context.getPackageManager().getPackageInfo(context.getPackageName(),
                0).versionName;
        int versionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;

        String subject = "Alfresco Activiti Android Feedback";
        iBuilder.setSubject(subject);

        // Content
        DisplayMetrics dm = context.getResources().getDisplayMetrics();
        String densityBucket = getDensityString(dm);

        Map<String, String> info = new LinkedHashMap<>();
        info.put("Version", versionName);
        info.put("Version code", Integer.toString(versionCode));
        info.put("Make", Build.MANUFACTURER);
        info.put("Model", Build.MODEL);
        info.put("Resolution", dm.heightPixels + "x" + dm.widthPixels);
        info.put("Density", dm.densityDpi + "dpi (" + densityBucket + ")");
        info.put("Release", Build.VERSION.RELEASE);
        info.put("API", String.valueOf(Build.VERSION.SDK_INT));
        info.put("Language", context.getResources().getConfiguration().locale.getDisplayLanguage());

        StringBuilder builder = new StringBuilder();
        builder.append("\n\n\n\n");
        builder.append("Alfresco Activiti Mobile and device details\n");
        builder.append("-------------------\n").toString();
        for (Map.Entry entry : info.entrySet()) {
            builder.append(entry.getKey()).append(": ").append(entry.getValue()).append('\n');
        }

        builder.append("-------------------\n\n").toString();
        iBuilder.setType("message/rfc822");
        iBuilder.setText(builder.toString());
        iBuilder.setChooserTitle(fr.getString(R.string.settings_feedback_email)).startChooser();

        return true;
    } catch (Exception e) {
        Log.d("Action Send Feedback", Log.getStackTraceString(e));
    }

    return false;
}

From source file:com.fastbootmobile.encore.app.OmniMusic.java

@Override
public void onCreate() {
    super.onCreate();

    // We need to filter here whether we're initializing the main app or an aux attached plugin
    String appName = Utils.getAppNameByPID(this, android.os.Process.myPid());
    final String process = appName.substring(appName.indexOf(':') + 1);

    Sentry.setCaptureListener(new Sentry.SentryEventCaptureListener() {
        @Override//w w w . j  a  v  a2s.  c  o m
        public Sentry.SentryEventBuilder beforeCapture(Sentry.SentryEventBuilder sentryEventBuilder) {
            JSONObject tags = sentryEventBuilder.getTags();
            try {
                tags.put("OS", "Android " + Build.VERSION.RELEASE);
                tags.put("OSCodename", Build.VERSION.CODENAME);
                tags.put("Device", Build.DEVICE);
                tags.put("Model", Build.MODEL);
                tags.put("Manufacturer", Build.MANUFACTURER);
                tags.put("AppVersionCode", String.valueOf(BuildConfig.VERSION_CODE));
                tags.put("AppVersionName", BuildConfig.VERSION_NAME);
                tags.put("AppFlavor", BuildConfig.FLAVOR);
            } catch (JSONException e) {
                Log.e(TAG, "Failed to put a tag into Sentry", e);
            }

            sentryEventBuilder.addModule(process, BuildConfig.VERSION_NAME);
            return sentryEventBuilder;
        }
    });
    Sentry.init(this,
            "https://4dc1acbdb1cb423282e2a59f553e1153:9415087b9e1348c3ba4bed44be599f6a@sentry.fastboot.mobi/2");

    // Setup LeakCanary
    mRefWatcher = LeakCanary.install(this);

    if (PROCESS_APP.equals(process)) {
        // Setup the plugins system
        ProviderAggregator.getDefault().setContext(getApplicationContext());
        PluginsLookup.getDefault().initialize(getApplicationContext());

        /**
         * Note about the cache and EchoNest: The HTTP cache would sometimes cache request
         * we didn't want (such as status query for Taste Profile update). We're using
         * a hacked jEN library that doesn't cache these requests.
         */
        // Setup network cache
        try {
            final File httpCacheDir = new File(getCacheDir(), "http");
            final long httpCacheSize = 100 * 1024 * 1024; // 100 MiB
            final HttpResponseCache cache = HttpResponseCache.install(httpCacheDir, httpCacheSize);

            Log.i(TAG, "HTTP Cache size: " + cache.size() / 1024 / 1024 + "MB");
        } catch (IOException e) {
            Log.w(TAG, "HTTP response cache installation failed", e);
        }

        // Setup image cache
        ImageCache.getDefault().initialize(getApplicationContext());

        // Setup Automix system
        AutoMixManager.getDefault().initialize(getApplicationContext());

        // Setup custom fonts
        CalligraphyConfig.initDefault("fonts/Roboto-Regular.ttf", R.attr.fontPath);
    }
}

From source file:com.auth0.api.internal.BaseRequest.java

public BaseRequest(Handler handler, HttpUrl url, OkHttpClient client, ObjectReader reader, ObjectWriter writer,
        BaseCallback<T> callback) {
    this.handler = handler;
    this.url = url;
    this.client = client;
    this.reader = reader;
    this.writer = writer;
    this.callback = callback;
    this.headers = new HashMap<>();
    this.parameters = new HashMap<>();
    this.headers.put("User-Agent",
            String.format("Android %s (%s %s;)", Build.VERSION.RELEASE, Build.MODEL, Build.MANUFACTURER));
}

From source file:com.stoutner.privacybrowser.AboutTabFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View tabLayout;/*  w  w w  .  java 2s.c om*/

    // Load the about tab layout.  Tab numbers start at 0.
    if (tabNumber == 0) {
        // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.
        // The fragment will take care of attaching the root automatically.
        tabLayout = inflater.inflate(R.layout.about_tab_version, container, false);

        // Version.
        TextView versionNumberText = (TextView) tabLayout.findViewById(R.id.about_version_number_text);
        String version = getString(R.string.version) + " " + BuildConfig.VERSION_NAME + " ("
                + getString(R.string.version_code) + " " + Integer.toString(BuildConfig.VERSION_CODE) + ")";
        versionNumberText.setText(version);

        // Brand.
        TextView versionBrandText = (TextView) tabLayout.findViewById(R.id.about_version_brand_text);
        versionBrandText.setText(Build.BRAND);

        // Manufacturer.
        TextView versionManufacturerText = (TextView) tabLayout
                .findViewById(R.id.about_version_manufacturer_text);
        versionManufacturerText.setText(Build.MANUFACTURER);

        // Model.
        TextView versionModelText = (TextView) tabLayout.findViewById(R.id.about_version_model_text);
        versionModelText.setText(Build.MODEL);

        // Device.
        TextView versionDeviceText = (TextView) tabLayout.findViewById(R.id.about_version_device_text);
        versionDeviceText.setText(Build.DEVICE);

        // Bootloader.
        TextView versionBootloaderText = (TextView) tabLayout.findViewById(R.id.about_version_bootloader_text);
        versionBootloaderText.setText(Build.BOOTLOADER);

        // Radio.
        TextView versionRadioText = (TextView) tabLayout.findViewById(R.id.about_version_radio_text);
        // Hide versionRadioTextView if there is no radio.
        if (Build.getRadioVersion().equals("")) {
            TextView versionRadioTitle = (TextView) tabLayout.findViewById(R.id.about_version_radio_title);
            versionRadioTitle.setVisibility(View.GONE);
            versionRadioText.setVisibility(View.GONE);
        } else { // Else, set the text.
            versionRadioText.setText(Build.getRadioVersion());
        }

        // Android.
        TextView versionAndroidText = (TextView) tabLayout.findViewById(R.id.about_version_android_text);
        String android = Build.VERSION.RELEASE + " (" + getString(R.string.api) + " "
                + Integer.toString(Build.VERSION.SDK_INT) + ")";
        versionAndroidText.setText(android);

        // Build.
        TextView versionBuildText = (TextView) tabLayout.findViewById(R.id.about_version_build_text);
        versionBuildText.setText(Build.DISPLAY);

        // Security Patch.
        TextView versionSecurityPatchText = (TextView) tabLayout
                .findViewById(R.id.about_version_securitypatch_text);
        // Build.VERSION.SECURITY_PATCH is only available for SDK_INT >= 23.
        if (Build.VERSION.SDK_INT >= 23) {
            versionSecurityPatchText.setText(Build.VERSION.SECURITY_PATCH);
        } else { // Hide versionSecurityPatchTextView.
            TextView versionSecurityPatchTitle = (TextView) tabLayout
                    .findViewById(R.id.about_version_securitypatch_title);
            versionSecurityPatchTitle.setVisibility(View.GONE);
            versionSecurityPatchText.setVisibility(View.GONE);
        }

        // webViewLayout is only used to get the default user agent from about_tab_webview.  It is not used to render content on the screen.
        View webViewLayout = inflater.inflate(R.layout.about_tab_webview, container, false);
        WebView tabLayoutWebView = (WebView) webViewLayout.findViewById(R.id.about_tab_webview);
        String userAgentString = tabLayoutWebView.getSettings().getUserAgentString();

        // WebKit.
        TextView versionWebKitText = (TextView) tabLayout.findViewById(R.id.about_version_webkit_text);
        // Select the substring that begins after "Safari/" and goes to the end of the string.
        String webkitVersion = userAgentString.substring(userAgentString.indexOf("Safari/") + 7);
        versionWebKitText.setText(webkitVersion);

        // Chrome.
        TextView versionChromeText = (TextView) tabLayout.findViewById(R.id.about_version_chrome_text);
        // Select the substring that begins after "Chrome/" and goes until the next " ".
        String chromeVersion = userAgentString.substring(userAgentString.indexOf("Chrome/") + 7,
                userAgentString.indexOf(" ", userAgentString.indexOf("Chrome/")));
        versionChromeText.setText(chromeVersion);
    } else { // load a WebView for all the other tabs.  Tab numbers start at 0.
        // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.
        // The fragment will take care of attaching the root automatically.
        tabLayout = inflater.inflate(R.layout.about_tab_webview, container, false);
        WebView tabWebView = (WebView) tabLayout;

        switch (tabNumber) {
        case 1:
            tabWebView.loadUrl("file:///android_asset/about_permissions.html");
            break;

        case 2:
            tabWebView.loadUrl("file:///android_asset/about_privacy_policy.html");
            break;

        case 3:
            tabWebView.loadUrl("file:///android_asset/about_changelog.html");
            break;

        case 4:
            tabWebView.loadUrl("file:///android_asset/about_license.html");
            break;

        case 5:
            tabWebView.loadUrl("file:///android_asset/about_contributors.html");
            break;

        case 6:
            tabWebView.loadUrl("file:///android_asset/about_links.html");

        default:
            break;
        }
    }

    return tabLayout;
}

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  ww  w  .  ja v  a 2 s . co  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:de.hackerspacebremen.communication.HackerspaceComm.java

protected final JSONObject doInBackground(final JSONObject... data) {
    final String userAgent = "HackerSpaceBremen/" + this.appVersionName + "; Android/" + Build.VERSION.RELEASE
            + "; " + Build.MANUFACTURER + "; " + Build.DEVICE + "; " + Build.MODEL;

    HttpClient httpclient = new DefaultHttpClient();
    HttpParams httpBodyParams = httpclient.getParams();
    httpBodyParams.setParameter(CoreProtocolPNames.USER_AGENT, userAgent);

    String response = null;/* w ww  .j  a  v  a2 s.c  o m*/
    int responseCode = 0;
    String httpOrS = HTTPS;
    if (httpReq) {
        httpOrS = HTTP;
    }

    if (getReq) {
        try {
            final HttpURLConnection connection = client
                    .open(new URL(httpOrS + SERVERURL + this.servletUrl + "?" + getParams));
            InputStream in = null;
            try {
                // Read the response.
                in = connection.getInputStream();
                final byte[] resp = readFully(in);
                response = new String(resp, Constants.UTF8);
                responseCode = connection.getResponseCode();
            } finally {
                if (in != null)
                    in.close();
            }
            // HttpGet httpget = new HttpGet(httpOrS + SERVERURL
            // + this.servletUrl + "?" + getParams);
            // response = httpclient.execute(httpget);
        } catch (IOException e) {
            errorcode = -1;
            cancel(false);
            return null;
        }
    } else {
        try {
            HttpURLConnection connection = client.open(new URL(httpOrS + SERVERURL + this.servletUrl));
            OutputStream out = null;
            InputStream in = null;
            try {
                // Write the request.
                connection.setRequestMethod("POST");
                out = connection.getOutputStream();
                out.write(createBody().getBytes(Constants.UTF8));
                out.close();

                responseCode = connection.getResponseCode();
                in = connection.getInputStream();
                response = readFirstLine(in);
            } finally {
                // Clean up.
                if (out != null)
                    out.close();
                if (in != null)
                    in.close();
            }
            // HttpPost httpPost = new HttpPost(httpOrS + SERVERURL
            // + this.servletUrl);
            // httpPost.setEntity(new UrlEncodedFormEntity(postParams,
            // "UTF-8"));
            // response = httpclient.execute(httpPost);

        } catch (IOException e) {
            errorcode = -1;
            cancel(false);
            return null;
        }
    }

    httpState = responseCode;

    JSONObject resData = new JSONObject();
    String resString = "";
    try {
        resString = response;
        resData = new JSONObject(resString);
        if (httpState != 200) {
            errorcode = resData.getInt("CODE");
            cancel(false);
            return null;
        }

    } catch (JSONException e) {
        if (httpState != 200) {
            errorcode = httpState;
        } else {
            errorcode = -2;
        }
        cancel(false);
        return null;
    }

    return resData;
}

From source file:org.pixmob.droidlink.net.NetworkClient.java

private static final String generateUserAgent(Context context) {
    if (applicationVersion == null) {
        try {/*from  w w  w.  j av a 2  s.co m*/
            applicationVersion = context.getPackageManager().getPackageInfo(context.getPackageName(),
                    0).versionName;
        } catch (NameNotFoundException e) {
            applicationVersion = "0.0.0";
        }
    }
    return APPLICATION_NAME + "/" + applicationVersion + " (" + Build.MANUFACTURER + " " + Build.MODEL
            + " with Android " + Build.VERSION.RELEASE + "/" + Build.VERSION.SDK_INT + ")";
}

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

protected Device(@NonNull Context context) {
    mContext = context;/*from  ww  w  . j  av a  2s. c o 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:org.pixmob.droidlink.service.DeviceInitService.java

private void generateId() {
    if (!prefs.contains(SP_KEY_DEVICE_NAME)) {
        final String deviceName = Build.MANUFACTURER + " " + Build.MODEL;
        prefsEditor.putString(SP_KEY_DEVICE_NAME, deviceName);
        Features.getFeature(SharedPreferencesSaverFeature.class).save(prefsEditor);
    }//  w ww.  j  a  va  2s.  c  o m

    final String account = prefs.getString(SP_KEY_ACCOUNT, null);
    if (account == null) {
        Log.i(TAG, "No account set: cannot generate device identifier");
        return;
    }

    if (!prefs.contains(SP_KEY_DEVICE_ID)) {
        final String deviceId = DeviceUtils.getDeviceId(this, account);
        Log.i(TAG, "Device identifier generated for " + account + ": " + deviceId);

        prefsEditor.putString(SP_KEY_DEVICE_ID, deviceId);
        Features.getFeature(SharedPreferencesSaverFeature.class).save(prefsEditor);
    }
}

From source file:io.teak.sdk.DeviceConfiguration.java

public DeviceConfiguration(@NonNull final Context context, @NonNull AppConfiguration appConfiguration) {
    if (android.os.Build.VERSION.RELEASE == null) {
        this.platformString = "android_unknown";
    } else {/*  www.j  a v  a  2 s.c o m*/
        this.platformString = "android_" + android.os.Build.VERSION.RELEASE;
    }

    // Preferences file
    {
        SharedPreferences tempPreferences = null;
        try {
            tempPreferences = context.getSharedPreferences(Teak.PREFERENCES_FILE, Context.MODE_PRIVATE);
        } catch (Exception e) {
            Log.e(LOG_TAG, "Error calling getSharedPreferences(). " + Log.getStackTraceString(e));
        } finally {
            this.preferences = tempPreferences;
        }

        if (this.preferences == null) {
            Log.e(LOG_TAG, "getSharedPreferences() returned null. Some caching is disabled.");
        }
    }

    // Device model/manufacturer
    // https://raw.githubusercontent.com/jaredrummler/AndroidDeviceNames/master/library/src/main/java/com/jaredrummler/android/device/DeviceName.java
    {
        this.deviceManufacturer = Build.MANUFACTURER == null ? "" : Build.MANUFACTURER;
        this.deviceModel = Build.MODEL == null ? "" : Build.MODEL;
        if (this.deviceModel.startsWith(Build.MANUFACTURER)) {
            this.deviceFallback = capitalize(Build.MODEL);
        } else {
            this.deviceFallback = capitalize(Build.MANUFACTURER) + " " + Build.MODEL;
        }
    }

    // Device id
    {
        String tempDeviceId = null;
        try {
            tempDeviceId = UUID.nameUUIDFromBytes(android.os.Build.SERIAL.getBytes("utf8")).toString();
        } catch (Exception e) {
            Log.e(LOG_TAG, "android.os.Build.SERIAL not available, falling back to Settings.Secure.ANDROID_ID. "
                    + Log.getStackTraceString(e));
        }

        if (tempDeviceId == null) {
            try {
                String androidId = Settings.Secure.getString(context.getContentResolver(),
                        Settings.Secure.ANDROID_ID);
                if (androidId.equals("9774d56d682e549c")) {
                    Log.e(LOG_TAG,
                            "Settings.Secure.ANDROID_ID == '9774d56d682e549c', falling back to random UUID stored in preferences.");
                } else {
                    tempDeviceId = UUID.nameUUIDFromBytes(androidId.getBytes("utf8")).toString();
                }
            } catch (Exception e) {
                Log.e(LOG_TAG,
                        "Error generating device id from Settings.Secure.ANDROID_ID, falling back to random UUID stored in preferences. "
                                + Log.getStackTraceString(e));
            }
        }

        if (tempDeviceId == null) {
            if (this.preferences != null) {
                tempDeviceId = this.preferences.getString(PREFERENCE_DEVICE_ID, null);
                if (tempDeviceId == null) {
                    try {
                        String prefDeviceId = UUID.randomUUID().toString();
                        SharedPreferences.Editor editor = this.preferences.edit();
                        editor.putString(PREFERENCE_DEVICE_ID, prefDeviceId);
                        editor.apply();
                        tempDeviceId = prefDeviceId;
                    } catch (Exception e) {
                        Log.e(LOG_TAG,
                                "Error storing random UUID, no more fallbacks. " + Log.getStackTraceString(e));
                    }
                }
            } else {
                Log.e(LOG_TAG,
                        "getSharedPreferences() returned null, unable to store random UUID, no more fallbacks.");
            }
        }

        this.deviceId = tempDeviceId;

        if (this.deviceId == null) {
            return;
        }
    }

    // Kick off GCM request
    if (this.preferences != null) {
        int storedAppVersion = this.preferences.getInt(PREFERENCE_APP_VERSION, 0);
        String storedGcmId = this.preferences.getString(PREFERENCE_GCM_ID, null);
        if (storedAppVersion == appConfiguration.appVersion && storedGcmId != null) {
            // No need to get a new one, so put it on the blocking queue
            if (Teak.isDebug) {
                Log.d(LOG_TAG, "GCM Id found in cache: " + storedGcmId);
            }
            this.gcmId = storedGcmId;
            displayGCMDebugMessage();
        }
    }

    this.gcm = new FutureTask<>(new RetriableTask<>(100, 2000L, new Callable<GoogleCloudMessaging>() {
        @Override
        public GoogleCloudMessaging call() throws Exception {
            return GoogleCloudMessaging.getInstance(context);
        }
    }));
    new Thread(this.gcm).start();

    if (this.gcmId == null) {
        registerForGCM(appConfiguration);
    }

    // Kick off Advertising Info request
    fetchAdvertisingInfo(context);
}