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.droid.app.fotobot.FotoBot.java

/**
 *   ?  ? ? /* w  w w. j  ava2  s  .c  o m*/
 *
 * @param h
 * @param str
 */
public void SendMail(Handler h, String str, String fc_str, String bc_video, String fc_video) {

    //        final FotoBot fb = (FotoBot) getApplicationContext();

    Mail m = new Mail(getApplicationContext(), EMail_Sender, EMail_Sender_Password, SMTP_Host, SMTP_Port);

    String[] toArr = { EMail_Recepient };

    String s = "Debug-infos:";
    s += "\n OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL
            + ")";
    s += "\n OS API Level: " + android.os.Build.VERSION.SDK_INT;
    s += "\n Device: " + android.os.Build.DEVICE;
    s += "\n Model (and Product): " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")";

    s += "\n RELEASE: " + android.os.Build.VERSION.RELEASE;
    s += "\n BRAND: " + android.os.Build.BRAND;
    s += "\n DISPLAY: " + android.os.Build.DISPLAY;
    s += "\n CPU_ABI: " + android.os.Build.CPU_ABI;
    s += "\n CPU_ABI2: " + android.os.Build.CPU_ABI2;
    s += "\n UNKNOWN: " + android.os.Build.UNKNOWN;
    s += "\n HARDWARE: " + android.os.Build.HARDWARE;
    s += "\n Build ID: " + android.os.Build.ID;
    s += "\n MANUFACTURER: " + android.os.Build.MANUFACTURER;
    s += "\n SERIAL: " + android.os.Build.SERIAL;
    s += "\n USER: " + android.os.Build.USER;
    s += "\n HOST: " + android.os.Build.HOST;

    m.setTo(toArr);
    m.setFrom(EMail_Sender);
    m.setSubject("Fotobot v" + versionName + " " + Camera_Name);

    String email_body = "";

    email_body = "Fotobot v" + versionName + "\n" + "---------------------------------------------\n"
            + "Camera Name" + ": " + Camera_Name + "\n" + getResources().getString(R.string.battery_charge)
            + ": " + battery_level + "%" + "\n" + getResources().getString(R.string.battery_temperature) + ": "
            + battery_temperature + "C" + "\n";

    if (Attached_Info_Detailisation.equals("Normal") || Attached_Info_Detailisation.equals("Detailed")) {

        email_body = email_body + getResources().getString(R.string.gsm) + ": " + GSM_Signal + "ASU    "
                + (2.0 * GSM_Signal - 113) + "dBm" + "\n" + "-50 -82 dbm   -   very good" + "\n"
                + "-83 -86 dbm   -   good" + "\n" + "-87 -91 dbm   -   normal" + "\n" + "-92 -95 dbm   -   bad"
                + "\n" + "-96 -100 dbm   -  almost no signal" + "\n"
                + "---------------------------------------------\n" + "Image Index:" + Image_Index + "\n"
                + "---------------------------------------------\n"
                + getResources().getString(R.string.phone_memory) + ":" + "\n" + "totalMemory: " + totalMemory
                + "\n" + "usedMemory: " + usedMemory + "\n" + "freeMemory: " + freeMemory + "\n"
                + "---------------------------------------------\n"
                + getResources().getString(R.string.email_sending_time) + ": " + email_sending_time + "\n"
                + "---------------------------------------------\n"
                + getResources().getString(R.string.Fotobot_settings) + ":\n" + "Network_Channel: "
                + Network_Channel + "\n" + "Network_Connection_Method: " + Network_Connection_Method + "\n"
                + "Use_Flash: " + Use_Flash + "\n" + "JPEG_Compression: " + JPEG_Compression + "\n"
                + "Photo_Frequency: " + Photo_Frequency + "\n" + "process_delay: " + process_delay + "\n"
                + "Image_Scale: " + Image_Scale + "\n" + "Image_Size: " + Image_Size + "\n" + "EMail_Sender: "
                + EMail_Sender + "\n" + "EMail_Sender_Password: *********" + "\n" + "EMail_Recepient: "
                + EMail_Recepient + "\n" + "Log_Font_Size: " + Log_Font_Size + "\n" + "Config_Font_Size: "
                + Config_Font_Size + "\n" + "Photo_Post_Processing_Method: " + Photo_Post_Processing_Method
                + "\n" + "SMTP_Host: " + SMTP_Host + "\n" + "SMTP_Port: " + SMTP_Port + "\n" + "Log length: "
                + loglength + "\n" + "FLog length: " + floglength + "\n" + "wake_up_interval: "
                + wake_up_interval + "\n" + "---------------------------------------------\n"
                + getResources().getString(R.string.hardware_info) + ":\n" + "Android: " + Build.VERSION.SDK_INT
                + "\n" + s + "\n" + "---------------------------------------------\n"
                + "Available SMS commands: " + "\n" + sms_commands_list() + "\n";
        ;
        if (Attached_Info_Detailisation.equals("Detailed")) {
            email_body = email_body + "\n\n\nActive tasks:\n" + Top + "\n\n\nBack Camera Properties:\n"
                    + Camera_Properties + "\n\n\nFront Camera Properties:\n" + fc_Camera_Properties;
        }

    }

    m.setBody(email_body);

    File attach_file;

    if (make_photo_bc && bc_image_attach) {

        attach_file = new File(str);
        boolean fileExists = attach_file.isFile();

        if (fileExists) {

        } else {
            SendMessage("ERROR: image doesn't exist for attaching to email.", MSG_FAIL);
        }
    }

    if (make_video_bc && bc_video_attach) {

        attach_file = new File(bc_video);
        boolean fileExists = attach_file.isFile();

        if (fileExists) {

        } else {
            SendMessage("ERROR: video " + bc_video + " doesn't exist for attaching to email.", MSG_FAIL);
        }
    }

    if (front_camera && make_photo_fc && fc_image_attach) {

        attach_file = new File(fc_str);
        boolean fc_fileExists = attach_file.isFile();

        if (front_camera && fc_fileExists && make_photo_fc) {

        } else {
            SendMessage("ERROR: front camera image doesn't exist for attaching to email.", MSG_FAIL);
        }
    }

    if (front_camera && make_video_fc && fc_video_attach) {

        attach_file = new File(fc_video);
        boolean fc_fileExists = attach_file.isFile();

        if (front_camera && fc_fileExists && make_photo_fc) {

        } else {
            SendMessage("ERROR: video " + fc_video + " doesn't exist for attaching to email.", MSG_FAIL);
        }
    }

    if (attach_log) {
        attach_file = new File((work_dir + "/logfile.txt"));
        boolean fileExists = attach_file.isFile();

        if (fileExists) {

        } else {
            SendMessage("ERROR: log doesn't exist for attaching to email.", MSG_FAIL);
        }

    }
    try {

        if (make_photo_bc && bc_image_attach) {
            m.addAttachment(str);
        }

        if (front_camera && make_photo_fc && fc_image_attach) {
            m.addAttachment(fc_str);
        }

        if (make_video_bc && bc_image_attach) {
            m.addAttachment(bc_video);
        }

        if (front_camera && make_video_fc && fc_image_attach) {
            m.addAttachment(fc_video);
        }

        if (attach_log) {
            m.addAttachment(work_dir + "/logfile.txt");
        }
        fbpause(h, process_delay);

        if (m.send()) {

            SendMessage(getResources().getString(R.string.foto_sent), MSG_PASS);

            SaveSettings();

        } else {
            SendMessage("ERROR: ?   ", MSG_FAIL);
        }
    } catch (Exception e) {
        SendMessage("Could not send email", MSG_FAIL);
        Log.e("MailApp", "Could not send email", e);
    }

}

From source file:org.strongswan.android.logic.CharonVpnService.java

/**
 * Function called via JNI to determine information about the device.
 *//* ww w .  jav a 2s. co  m*/
private static String getDeviceString() {
    return Build.MODEL + " - " + Build.BRAND + "/" + Build.PRODUCT + "/" + Build.MANUFACTURER;
}

From source file:org.videolan.vlc.gui.MyFragment.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    //Filter for LG devices, see https://code.google.com/p/android/issues/detail?id=78154
    btn = (Button) findViewById(R.id.back_btn);
    if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
        //btn=(Button) findViewById(R.id.back_btn);
        btn.setVisibility(View.VISIBLE);
        super.onBackPressed();
        return false;
    } else {// w  ww . j  a va  2  s. c o  m
        if (getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder) != null) {
            //((FilePickerFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder)).browseUp();
            btn.setVisibility(View.GONE);
            finish();
            return false;
        }
    }
    //key_back() ;

    if ((keyCode == KeyEvent.KEYCODE_MENU) && (Build.VERSION.SDK_INT <= 16)
            && (Build.MANUFACTURER.compareTo("LGE") == 0)) {
        return true;
    }
    if (mFocusedPrior == 0)
        setMenuFocusDown(true, 0);
    if (getCurrentFocus() != null)
        mFocusedPrior = getCurrentFocus().getId();
    return super.onKeyDown(keyCode, event);
}

From source file:de.mkrtchyan.recoverytools.RecoveryTools.java

public void report(final boolean isCancelable) {
    final Dialog reportDialog = mNotifyer.createDialog(R.string.commentar, R.layout.dialog_comment, false,
            true);/*w ww.  j a  v  a  2 s  .c o m*/
    new Thread(new Runnable() {
        @Override
        public void run() {
            /** Creates a report Email including a Comment and important device infos */
            final Button bGo = (Button) reportDialog.findViewById(R.id.bGo);
            bGo.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {

                    if (!Common.getBooleanPref(mContext, PREF_NAME, PREF_KEY_ADS))
                        Toast.makeText(mContext, R.string.please_ads, Toast.LENGTH_SHORT).show();
                    Toast.makeText(mContext, R.string.donate_to_support, Toast.LENGTH_SHORT).show();
                    try {
                        ArrayList<File> files = new ArrayList<File>();
                        File TestResults = new File(mContext.getFilesDir(), "results.txt");
                        try {
                            if (TestResults.exists()) {
                                if (TestResults.delete()) {
                                    FileOutputStream fos = openFileOutput(TestResults.getName(),
                                            Context.MODE_PRIVATE);
                                    fos.write(("Recovery-Tools:\n\n"
                                            + mShell.execCommand(
                                                    "ls -lR " + PathToRecoveryTools.getAbsolutePath())
                                            + "\nCache Tree:\n" + mShell.execCommand("ls -lR /cache") + "\n"
                                            + "\nMTD result:\n" + mShell.execCommand("cat /proc/mtd") + "\n"
                                            + "\nDevice Tree:\n\n" + mShell.execCommand("ls -lR /dev"))
                                                    .getBytes());
                                }
                                files.add(TestResults);
                            }
                        } catch (FileNotFoundException e) {
                            e.printStackTrace();
                        }
                        if (getPackageManager() != null) {
                            PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
                            EditText text = (EditText) reportDialog.findViewById(R.id.etComment);
                            String comment = "";
                            if (text.getText() != null)
                                comment = text.getText().toString();
                            Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
                            intent.setType("text/plain");
                            intent.putExtra(Intent.EXTRA_EMAIL,
                                    new String[] { "ashotmkrtchyan1995@gmail.com" });
                            intent.putExtra(Intent.EXTRA_SUBJECT, "Recovery-Tools report");
                            intent.putExtra(Intent.EXTRA_TEXT, "Package Infos:" + "\n\nName: "
                                    + pInfo.packageName + "\nVersionName: " + pInfo.versionName
                                    + "\nVersionCode: " + pInfo.versionCode + "\n\n\nProduct Info: "
                                    + "\n\nManufacture: " + android.os.Build.MANUFACTURER + "\nDevice: "
                                    + Build.DEVICE + " (" + mDevice.getDeviceName() + ")" + "\nBoard: "
                                    + Build.BOARD + "\nBrand: " + Build.BRAND + "\nModel: " + Build.MODEL
                                    + "\nFingerprint: " + Build.FINGERPRINT + "\nAndroid SDK Level: "
                                    + Build.VERSION.CODENAME + " (" + Build.VERSION.SDK_INT + ")"
                                    + "\nRecovery Supported: " + mDevice.isRecoverySupported()
                                    + "\nRecovery Path: " + mDevice.getRecoveryPath() + "\nRecovery Version: "
                                    + mDevice.getRecoveryVersion() + "\nRecovery MTD: "
                                    + mDevice.isRecoveryMTD() + "\nRecovery DD: " + mDevice.isRecoveryDD()
                                    + "\nKernel Supported: " + mDevice.isKernelSupported() + "\nKernel Path: "
                                    + mDevice.getKernelPath() + "\nKernel Version: "
                                    + mDevice.getKernelVersion() + "\nKernel MTD: " + mDevice.isKernelMTD()
                                    + "\nKernel DD: " + mDevice.isKernelDD() + "\n\nCWM: "
                                    + mDevice.isCwmSupported() + "\nTWRP: " + mDevice.isTwrpSupported()
                                    + "\nPHILZ: " + mDevice.isPhilzSupported()
                                    + "\n\n\n===========COMMENT==========\n" + comment
                                    + "\n===========COMMENT END==========\n" + "\n===========PREFS==========\n"
                                    + getAllPrefs() + "\n===========PREFS END==========\n");
                            File CommandLogs = new File(mContext.getFilesDir(), Shell.Logs);
                            if (CommandLogs.exists()) {
                                files.add(CommandLogs);
                            }
                            files.add(new File(getFilesDir(), "last_log.txt"));
                            ArrayList<Uri> uris = new ArrayList<Uri>();
                            for (File file : files) {
                                mShell.execCommand("cp " + file.getAbsolutePath() + " "
                                        + new File(mContext.getFilesDir(), file.getName()).getAbsolutePath());
                                file = new File(mContext.getFilesDir(), file.getName());
                                mToolbox.setFilePermissions(file, "644");
                                uris.add(Uri.fromFile(file));
                            }
                            intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
                            startActivity(Intent.createChooser(intent, "Send over Gmail"));
                            reportDialog.dismiss();
                        }
                    } catch (Exception e) {
                        reportDialog.dismiss();
                        Notifyer.showExceptionToast(mContext, TAG, e);
                    }
                }
            });
        }
    }).start();
    reportDialog.setCancelable(isCancelable);
    reportDialog.show();
}

From source file:com.mobilyzer.util.PhoneUtils.java

public DeviceInfo getDeviceInfo() {

    if (deviceInfo == null) {
        deviceInfo = new DeviceInfo();
        deviceInfo.deviceId = getDeviceId();
        deviceInfo.manufacturer = Build.MANUFACTURER;
        deviceInfo.model = Build.MODEL;// www.java 2  s  .co  m
        deviceInfo.os = getVersionStr();
        deviceInfo.user = Build.VERSION.CODENAME;
    }

    return deviceInfo;
}

From source file:org.videolan.vlc.gui.MyFragment.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override//from   w  w  w. j  av a 2 s  .co m
public boolean onKeyUp(int keyCode, KeyEvent event) {
    //Filter for LG devices, see https://code.google.com/p/android/issues/detail?id=78154
    if ((keyCode == KeyEvent.KEYCODE_MENU) && (Build.VERSION.SDK_INT <= 16)
            && (Build.MANUFACTURER.compareTo("LGE") == 0)) {
        openOptionsMenu();
        return true;
    }
    View v = getCurrentFocus();
    if (v == null)
        return super.onKeyUp(keyCode, event);
    if ((mActionBarIconId == -1) && (v.getId() == -1) && (v.getNextFocusDownId() == -1)
            && (v.getNextFocusUpId() == -1) && (v.getNextFocusLeftId() == -1)
            && (v.getNextFocusRightId() == -1)) {
        mActionBarIconId = Util.generateViewId();
        v.setId(mActionBarIconId);
        v.setNextFocusUpId(mActionBarIconId);
        v.setNextFocusDownId(mActionBarIconId);
        v.setNextFocusLeftId(mActionBarIconId);
        v.setNextFocusRightId(R.id.ml_menu_search);
        if (AndroidUtil.isHoneycombOrLater())
            v.setNextFocusForwardId(mActionBarIconId);
        if (findViewById(R.id.ml_menu_search) != null)
            findViewById(R.id.ml_menu_search).setNextFocusLeftId(mActionBarIconId);
    }
    return super.onKeyUp(keyCode, event);
}

From source file:com.entradahealth.entrada.android.app.personal.activities.job_list.JobListActivity.java

public void sendLogs() {
    c = Calendar.getInstance();//from www . j a va  2s.c  om
    hr = c.get(Calendar.HOUR_OF_DAY);
    min = c.get(Calendar.MINUTE);
    year = c.get(Calendar.YEAR);
    mon = c.get(Calendar.MONTH);
    day = c.get(Calendar.DAY_OF_MONTH);

    if (hr >= 10)
        str_hr = Integer.toString(hr);
    else
        str_hr = "0" + Integer.toString(hr);

    if (min >= 10)
        str_min = Integer.toString(min);
    else
        str_min = "0" + Integer.toString(min);

    //file_name = BundleKeys.SYNC_FOR_CLINIC+"-"+BundleKeys.SYNC_FOR_ACC+"-"+year+"-"+(mon+1)+"-"+day+"-"+str_hr+"-"+str_min;
    file_name = year + "-" + (mon + 1) + "-" + day + "-" + str_hr + "-" + str_min;

    try {
        root = AndroidUtils.ENTRADA_DIR;
        Process process = Runtime.getRuntime().exec("logcat -d");
        mFolder = new File(root + "/Logs");
        if (!mFolder.exists()) {
            mFolder.mkdir();
        }
        //File logFile = new File(mFolder.getAbsolutePath(), file_name+".txt");
        logFile = new File(mFolder.getAbsolutePath(), "current.txt");
        String line;
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
        StringBuilder log = null;
        log = new StringBuilder();
        if (!logFile.exists()) {

            line = "Version Name: " + sp.getString("APP_VER_NAME", "5.3.0") + "\n";
            line = line + "Build: " + sp.getInt("APP_VER_CODE", 1) + "\n";
            line = line + "Android: " + android.os.Build.VERSION.RELEASE + "\n";
            line = line + "Manufacturer: " + android.os.Build.MANUFACTURER + "\n";
            line = line + "Model: " + android.os.Build.MODEL + "\n";
            log.append(line + "\n");

            while ((line = bufferedReader.readLine()) != null) {
                if (line.contains(processId))
                    log.append(line + "\n");
            }

            fOut = new FileOutputStream(logFile);
            myOutWriter = new OutputStreamWriter(fOut);
            myOutWriter.write(log.toString());
            myOutWriter.close();
            Log.e("VER -- BUILD",
                    sp.getString("APP_VER_NAME", "5.3.0") + " -- " + sp.getInt("APP_VER_CODE", 1));
        } else {
            long filesizeInKB;
            long filesize = logFile.length();
            filesizeInKB = filesize / 1024;

            if (filesizeInKB >= 250) {
                AsyncTaskSendLogFiles sendLogs = new AsyncTaskSendLogFiles();
                sendLogs.execute();
                //newFile = new File(mFolder.getAbsolutePath(), file_name+".txt");

            } else {
                while ((line = bufferedReader.readLine()) != null) {
                    if (line.contains(processId))
                        log.append(line + "\n");
                }

                fOut = new FileOutputStream(logFile);
                myOutWriter = new OutputStreamWriter(fOut);
                myOutWriter.write(log.toString());
                myOutWriter.close();
            }

        }

        root = AndroidUtils.ENTRADA_DIR;

    } catch (IOException e) {
        Toast.makeText(getApplicationContext(), e.getMessage(), 2000).show();

    }
}

From source file:org.computeforcancer.android.client.Monitor.java

/**
 * installs client binaries(if changed) and other required files
 * executes client process//from w ww .ja v  a  2 s  .c  om
 * triggers initial reads (e.g. preferences, project list etc)
 * @return Boolean whether connection established successfully
 */
private Boolean clientSetup() {
    if (Logging.ERROR)
        Log.d(Logging.TAG, "Monitor.clientSetup()");

    // try to get current client status from monitor
    ClientStatus status;
    try {
        status = Monitor.getClientStatus();
    } catch (Exception e) {
        if (Logging.WARNING)
            Log.w(Logging.TAG, "Monitor.clientSetup: Could not load data, clientStatus not initialized.");
        return false;
    }

    status.setSetupStatus(ClientStatus.SETUP_STATUS_LAUNCHING, true);
    String clientProcessName = boincWorkingDir + fileNameClient;

    String md5AssetClient = computeMd5(fileNameClient, true);
    //if(Logging.DEBUG) Log.d(Logging.TAG, "Hash of client (Asset): '" + md5AssetClient + "'");

    String md5InstalledClient = computeMd5(clientProcessName, false);
    //if(Logging.DEBUG) Log.d(Logging.TAG, "Hash of client (File): '" + md5InstalledClient + "'");

    // If client hashes do not match, we need to install the one that is a part
    // of the package. Shutdown the currently running client if needed.
    //
    if (forceReinstall || !md5InstalledClient.equals(md5AssetClient)) {
        if (Logging.DEBUG)
            Log.d(Logging.TAG, "Hashes of installed client does not match binary in assets - re-install.");

        // try graceful shutdown using RPC (faster)
        if (getPidForProcessName(clientProcessName) != null) {
            if (connectClient()) {
                clientInterface.quit();
                Integer attempts = getApplicationContext().getResources()
                        .getInteger(R.integer.shutdown_graceful_rpc_check_attempts);
                Integer sleepPeriod = getApplicationContext().getResources()
                        .getInteger(R.integer.shutdown_graceful_rpc_check_rate_ms);
                for (int x = 0; x < attempts; x++) {
                    try {
                        Thread.sleep(sleepPeriod);
                    } catch (Exception e) {
                    }
                    if (getPidForProcessName(clientProcessName) == null) { //client is now closed
                        if (Logging.DEBUG)
                            Log.d(Logging.TAG,
                                    "quitClient: gracefull RPC shutdown successful after " + x + " seconds");
                        x = attempts;
                    }
                }
            }
        }

        // quit with OS signals
        if (getPidForProcessName(clientProcessName) != null) {
            quitProcessOsLevel(clientProcessName);
        }

        // at this point client is definitely not running. install new binary...
        if (!installClient()) {
            if (Logging.ERROR)
                Log.w(Logging.TAG, "BOINC client installation failed!");
            return false;
        }
    }

    // Start the BOINC client if we need to.
    //
    Integer clientPid = getPidForProcessName(clientProcessName);
    if (clientPid == null) {
        if (Logging.ERROR)
            Log.d(Logging.TAG, "Starting the BOINC client");
        if (!runClient()) {
            if (Logging.ERROR)
                Log.d(Logging.TAG, "BOINC client failed to start");
            return false;
        }
    }

    // Try to connect to executed Client in loop
    //
    Integer retryRate = getResources().getInteger(R.integer.monitor_setup_connection_retry_rate_ms);
    Integer retryAttempts = getResources().getInteger(R.integer.monitor_setup_connection_retry_attempts);
    Boolean connected = false;
    Integer counter = 0;
    while (!connected && (counter < retryAttempts)) {
        if (Logging.DEBUG)
            Log.d(Logging.TAG, "Attempting BOINC client connection...");
        connected = connectClient();
        counter++;

        try {
            Thread.sleep(retryRate);
        } catch (Exception e) {
        }
    }

    Boolean init = false;
    if (connected) { // connection established
        try {
            // read preferences for GUI to be able to display data
            GlobalPreferences clientPrefs = clientInterface.getGlobalPrefsWorkingStruct();
            if (clientPrefs == null)
                throw new Exception("client prefs null");
            status.setPrefs(clientPrefs);

            // set Android model as hostinfo
            // should output something like "Samsung Galaxy SII - SDK:15 ABI:armeabi-v7a"
            String model = Build.MANUFACTURER + " " + Build.MODEL + " - SDK:" + Build.VERSION.SDK_INT + " ABI: "
                    + Build.CPU_ABI;
            String version = Build.VERSION.RELEASE;
            if (Logging.ERROR)
                Log.d(Logging.TAG, "reporting hostinfo model name: " + model);
            if (Logging.ERROR)
                Log.d(Logging.TAG, "reporting hostinfo os name: Android");
            if (Logging.ERROR)
                Log.d(Logging.TAG, "reporting hostinfo os version: " + version);
            clientInterface.setHostInfo(model, version);

            init = true;
        } catch (Exception e) {
            if (Logging.ERROR)
                Log.e(Logging.TAG, "Monitor.clientSetup() init failed: " + e.getMessage());
        }
    }

    if (init) {
        if (Logging.ERROR)
            Log.d(Logging.TAG, "Monitor.clientSetup() - setup completed successfully");
        status.setSetupStatus(ClientStatus.SETUP_STATUS_AVAILABLE, false);
    } else {
        if (Logging.ERROR)
            Log.e(Logging.TAG, "Monitor.clientSetup() - setup experienced an error");
        status.setSetupStatus(ClientStatus.SETUP_STATUS_ERROR, true);
    }

    return connected;
}

From source file:opensource.zeocompanion.ZeoCompanionApplication.java

public static void postToErrorLog(String method, Throwable theException, String extra, String threadName,
        boolean noAlert) {
    String eMsg = "Exception";
    if (method != null) {
        if (!method.isEmpty()) {
            eMsg = eMsg + " in " + method;
        }/*from   w  ww.ja v  a  2  s .c  o m*/
    }
    if (threadName != null) {
        if (!threadName.isEmpty()) {
            eMsg = eMsg + " in Thread " + threadName;
        }
    }
    if (extra != null) {
        if (!extra.isEmpty()) {
            eMsg = eMsg + " (" + extra + ")";
        }
    }
    eMsg = eMsg + ": " + theException.toString();
    Log.e(_CTAG + ".postToErrorLog", eMsg);
    theException.printStackTrace();

    int r = checkExternalStorage();
    if (r != 0) {
        Log.e(_CTAG + ".postToErrorLog", "Cannot write to external storage code " + r);
        return;
    }

    FileWriter wrt = null;
    try {
        // pull the stack trace
        StackTraceElement[] traces = theException.getStackTrace();

        // ensure the directory structure is present and compose the file name
        File internalsDir = new File(mBaseExtStorageDir + File.separator + "internals");
        internalsDir.mkdirs();
        File errLogFile = new File(internalsDir + File.separator + "error.log");

        // create and append to the file
        wrt = new FileWriter(errLogFile, true); // append if file already exists
        wrt.write(new Date().toString() + "\n");
        if (threadName != null) {
            if (!threadName.isEmpty()) {
                wrt.write(" in Thread " + threadName + " ");
            }
        }
        wrt.write("AppVerName " + BuildConfig.VERSION_NAME + " AppVerCode " + BuildConfig.VERSION_CODE);
        if (mDatabaseHandler != null) {
            wrt.write(" with DBver " + mDatabaseHandler.mVersion);
        }
        wrt.write("\n");
        if (mZeoAppHandler != null) {
            if (mZeoAppHandler.mZeoApp_versionName == null) {
                wrt.write("Zeo App not installed\n");
            } else {
                wrt.write("Zeo App version " + mZeoAppHandler.mZeoApp_versionName + " build "
                        + mZeoAppHandler.mZeoApp_versionCode + "\n");
            }
        }
        wrt.write("Android Version " + android.os.Build.VERSION.RELEASE + " API "
                + android.os.Build.VERSION.SDK_INT + "\n");
        wrt.write("Platform Manf " + Build.MANUFACTURER + " Model " + Build.MODEL + "\n");
        WindowManager windowManager = (WindowManager) mApp.getSystemService(Context.WINDOW_SERVICE);
        Display display = windowManager.getDefaultDisplay();
        Point screenSize = new Point();
        display.getSize(screenSize);
        wrt.write("Platform Screen Orientation X,Y " + screenSize.x + "," + screenSize.y + ", Density="
                + mScreenDensity + "\n");
        if (method != null) {
            if (!method.isEmpty()) {
                wrt.write(method + "\n");
            }
        }
        if (extra != null) {
            if (!extra.isEmpty()) {
                wrt.write(extra + "\n");
            }
        }
        wrt.write(theException.toString() + "\n");
        for (StackTraceElement st : traces) {
            wrt.write(st.toString() + "\n");
        }
        wrt.write("=====\n");
        wrt.write("=====\n");
        wrt.flush();
        wrt.close();

        // force it to be shown and post an alert
        forceShowOnPC(errLogFile);
        if (!noAlert) {
            postAlert("An abort occured; details are in \'internals/error.log\'; contact the Developer");
        } // noAlert is only needed when an Alert itself was being posted to the database and it failed to post

        // must send the toast indirectly in case this is being called from a utility thread
        Message msg = new Message();
        msg.what = ZeoCompanionApplication.MESSAGE_APP_SEND_TOAST;
        msg.obj = "Abort successfully logged to \'internals/error.log\'";
        mAppHandler.sendMessage(msg);
    } catch (Exception e) {
        if (wrt != null) {
            try {
                wrt.close();
            } catch (Exception ignored) {
            }
        }
        Log.e(_CTAG + ".postToErrLog", "Cannot write to error.log: " + e.toString());
        e.printStackTrace();
    }
}

From source file:opensource.zeocompanion.ZeoCompanionApplication.java

public static void postToErrorLog(String method, String errorMessage, String extra, boolean noAlert) {
    String eMsg = "Severe Error";
    if (method != null) {
        if (!method.isEmpty()) {
            eMsg = eMsg + " in " + method;
        }//  ww w .jav a2 s  .  c o m
    }
    if (extra != null) {
        if (!extra.isEmpty()) {
            eMsg = eMsg + " (" + extra + ")";
        }
    }
    eMsg = eMsg + ": " + errorMessage;
    Log.e(_CTAG + ".postToErrorLog", eMsg);

    int r = checkExternalStorage();
    if (r != 0) {
        Log.e(_CTAG + ".postToErrorLog", "Cannot write to external storage code " + r);
        return;
    }

    FileWriter wrt = null;
    try {
        // ensure the directory structure is present and compose the file name
        File internalsDir = new File(mBaseExtStorageDir + File.separator + "internals");
        internalsDir.mkdirs();
        File errLogFile = new File(internalsDir + File.separator + "error.log");

        // create and append to the file
        wrt = new FileWriter(errLogFile, true); // append if file already exists
        wrt.write(new Date().toString() + "\n");
        wrt.write("Appver " + BuildConfig.VERSION_NAME);
        if (mDatabaseHandler != null) {
            wrt.write(" with DBver " + mDatabaseHandler.mVersion);
        }
        wrt.write("\n");
        if (mZeoAppHandler != null) {
            if (mZeoAppHandler.mZeoApp_versionName == null) {
                wrt.write("Zeo App not installed\n");
            } else {
                wrt.write("Zeo App version " + mZeoAppHandler.mZeoApp_versionName + " build "
                        + mZeoAppHandler.mZeoApp_versionCode + "\n");
            }
        }
        wrt.write("Android Version " + android.os.Build.VERSION.RELEASE + " API "
                + android.os.Build.VERSION.SDK_INT + "\n");
        wrt.write("Platform Manf " + Build.MANUFACTURER + " Model " + Build.MODEL + "\n");
        if (method != null) {
            if (!method.isEmpty()) {
                wrt.write(method + "\n");
            }
        }
        if (extra != null) {
            if (!extra.isEmpty()) {
                wrt.write(extra + "\n");
            }
        }
        wrt.write(errorMessage + "\n");
        wrt.write("=====\n");
        wrt.write("=====\n");
        wrt.flush();
        wrt.close();

        // force it to be shown and post an alert
        forceShowOnPC(errLogFile);
        if (!noAlert) {
            postAlert("An abort occured; details are in \'internals/error.log\'; contact the Developer");
        } // noAlert is only needed when an Alert itself was being posted to the database and it failed to post

        // must send the toast indirectly in case this is being called from a utility thread
        Message msg = new Message();
        msg.what = ZeoCompanionApplication.MESSAGE_APP_SEND_TOAST;
        msg.obj = "Abort successfully logged to \'internals/error.log\'";
        mAppHandler.sendMessage(msg);
    } catch (Exception e) {
        if (wrt != null) {
            try {
                wrt.close();
            } catch (Exception ignored) {
            }
        }
        Log.e(_CTAG + ".postToErrLog", "Cannot write to error.log: " + e.toString());
        e.printStackTrace();
    }
}