List of usage examples for android.os Build MANUFACTURER
String MANUFACTURER
To view the source code for android.os Build MANUFACTURER.
Click Source Link
From source file:com.nbplus.push.PushService.java
/** * 1 ????... ? ./* w w w . ja v a2 s . co m*/ * @param url */ private void initPushGatewayTaskSettings(final String url) { if (mRequestBody == null) { String prefName = mContext.getApplicationContext().getPackageName() + "_preferences"; SharedPreferences prefs = mContext.getSharedPreferences(prefName, Context.MODE_PRIVATE); // load from preferences.. String deviceId = prefs.getString(PushConstants.KEY_DEVICE_ID, ""); if (StringUtils.isEmptyString(deviceId)) { deviceId = DeviceUtils.getDeviceIdByMacAddress(mContext); prefs.edit().putString(PushConstants.KEY_DEVICE_ID, deviceId).apply(); } GetPushInterfaceRequestBody reqBodyObj = new GetPushInterfaceRequestBody(); reqBodyObj.deviceId = deviceId; reqBodyObj.os = Build.VERSION.RELEASE; reqBodyObj.pushVersion = Integer.toString(BuildConfig.VERSION_CODE); reqBodyObj.vendor = Build.MANUFACTURER; reqBodyObj.model = DeviceUtils.getDeviceName(); reqBodyObj.os = Build.ID + " " + Build.VERSION.RELEASE; reqBodyObj.deviceType = "android"; Gson gson = new GsonBuilder().create(); mRequestBody = gson.toJson(reqBodyObj, new TypeToken<GetPushInterfaceRequestBody>() { }.getType()); } if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(mContext, new HurlStack() { @Override protected HttpURLConnection createConnection(URL url) throws IOException { HttpURLConnection connection = super.createConnection(url); // Fix for bug in Android runtime(!!!): // https://code.google.com/p/android/issues/detail?id=24672 connection.setRequestProperty("Accept-Encoding", ""); return connection; } }); mGwRequestFuture = RequestFuture.newFuture(); GsonRequest request = new GsonRequest(Request.Method.POST, url, mRequestBody, PushInterfaceData.class, mGwRequestFuture, mGwRequestFuture); request.setRetryPolicy(new DefaultRetryPolicy(20 * 1000, 3, 1.0f)); mRequestQueue.add(request); } }
From source file:com.num.mobiperf.Checkin.java
public void sendMeasurement(String string, Measurement measurement) { JSONObject status = new JSONObject(); long timestamp = System.currentTimeMillis() * 1000; DeviceProperty dp = new DeviceProperty(measurement.getDeviceId().toString(), "MySpeedTest", timestamp, getVersionStr(), "IPv4 only", "IPv4 only", (double) -84.38707806563192, (double) 33.81981981981981, "network", measurement.getNetwork().getConnectionType().toString(), measurement.getDevice().getNetworkName().toString(), measurement.getBattery().getLevel(), (measurement.getBattery().getPlugged() > 0) ? true : false, measurement.getNetwork().getCellType(), Integer.parseInt(measurement.getNetwork().getSignalStrength())); try {//from w w w . j a v a 2s .c o m status.put("id", measurement.getDeviceId()); status.put("manufacturer", Build.MANUFACTURER); status.put("model", Build.MODEL); status.put("os", getVersionStr()); status.put("properties", MeasurementJsonConvertor.encodeToJson(dp)); List<MeasurementResult> resultList = new ArrayList<MeasurementResult>(); Device device = measurement.getDevice(); Network network = measurement.getNetwork(); Battery battery = measurement.getBattery(); Sim sim = measurement.getSim(); State state = measurement.getState(); List<Ping> pings = measurement.getPings(); WarmupExperiment we = measurement.getWarmupExperiment(); List<LastMile> lm = measurement.getLastMiles(); Usage usage = measurement.getUsage(); GPS gps = measurement.getGps(); // NOT READY JSONObject devicejson; JSONObject networkjson; JSONObject batteryjson; JSONObject simjson; JSONObject statejson; JSONArray pingsarray; JSONObject wejson; JSONArray lastarray; JSONObject usagejson; JSONObject gpsjson; if (device != null) { devicejson = device.toJSON(); resultList.add(createResultList("device_info", dp, measurement, devicejson)); } if (network != null) { networkjson = network.toJSON(); resultList.add(createResultList("network_info", dp, measurement, networkjson));// networkjson)); } if (battery != null) { batteryjson = battery.toJSON(); resultList.add(createResultList("battery_info", dp, measurement, batteryjson)); } if (sim != null) { simjson = sim.toJSON(); resultList.add(createResultList("sim_info", dp, measurement, simjson)); } if (state != null) { statejson = state.toJSON(); resultList.add(createResultList("state_info", dp, measurement, statejson)); } // if (pings != null) { // pingsarray = new JSONArray(); // for (Ping p : pings) { // pingsarray.put(p.toJSON()); // } // //resultList.add(createResultList("pings_info", dp, measurement, pingsarray)); // } // if (we != null) { // wejson = we.toJSON(); // resultList.add(createResultList("warmup_info", dp, measurement, wejson)); // } // if (lm != null) { // lastarray = new JSONArray(); // for (LastMile l : lm) { // lastarray.put(l.toJSON()); // } // resultList.add(createResultList("lastmile_info", dp, measurement, lastarray)); // } if (usage != null) { usagejson = usage.toJSON(); resultList.add(createResultListUsage("usage_info", dp, measurement, usagejson)); } if (gps != null) { gpsjson = gps.toJSON(); //resultList.add(createResultList("gps_info", dp, measurement, gpsjson)); } // For each of the measurements create a status to send JSONArray resultArray = new JSONArray(); for (MeasurementResult result : resultList) { resultArray.put(MeasurementJsonConvertor.encodeToJson(result)); } String response = serviceRequest("postmeasurement", resultArray.toString()); System.out.println(response); } catch (Exception e) { System.out.println(e.getMessage()); } }
From source file:com.markupartist.sthlmtraveling.ChangeRouteTimeActivity.java
private static boolean isBrokenSamsungDevice() { return (Build.MANUFACTURER.equalsIgnoreCase("samsung") && isBetweenAndroidVersions(Build.VERSION_CODES.LOLLIPOP, Build.VERSION_CODES.LOLLIPOP_MR1)); }
From source file:com.google.android.apps.santatracker.rocketsleigh.RocketSleighActivity.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) @Override//from w w w.java 2 s . co m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(LOG_TAG, "onCreate() : " + savedInstanceState); setContentView(R.layout.activity_jet_pack_elf); // App Invites mInvitesFragment = AppInvitesFragment.getInstance(this); // App Measurement mMeasurement = FirebaseAnalytics.getInstance(this); MeasurementManager.recordScreenView(mMeasurement, getString(R.string.analytics_screen_rocket)); // [ANALYTICS SCREEN]: Rocket Sleigh AnalyticsManager.initializeAnalyticsTracker(this); AnalyticsManager.sendScreenView(R.string.analytics_screen_rocket); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { ImmersiveModeHelper.setImmersiveSticky(getWindow()); ImmersiveModeHelper.installSystemUiVisibilityChangeListener(getWindow()); } mIntroVideo = (VideoView) findViewById(R.id.intro_view); mIntroControl = findViewById(R.id.intro_control_view); if (savedInstanceState == null) { String path = "android.resource://" + getPackageName() + "/" + R.raw.jp_background; mBackgroundPlayer = new MediaPlayer(); try { mBackgroundPlayer.setDataSource(this, Uri.parse(path)); mBackgroundPlayer.setLooping(true); mBackgroundPlayer.prepare(); mBackgroundPlayer.start(); } catch (IOException e) { e.printStackTrace(); } boolean nomovie = false; if (getIntent().getBooleanExtra("nomovie", false)) { nomovie = true; } else if (Build.MANUFACTURER.toUpperCase().contains("SAMSUNG")) { // nomovie = true; } if (!nomovie) { mIntroControl.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { endIntro(); } }); path = "android.resource://" + getPackageName() + "/" + R.raw.intro_wipe; mIntroVideo.setVideoURI(Uri.parse(path)); mIntroVideo.setOnCompletionListener(this); mIntroVideo.start(); mMoviePlaying = true; } else { mIntroControl.setOnClickListener(null); mIntroControl.setVisibility(View.GONE); mIntroVideo.setVisibility(View.GONE); } } else { mIntroControl.setOnClickListener(null); mIntroControl.setVisibility(View.GONE); mIntroVideo.setVisibility(View.GONE); } mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // For hit indication. mHandler = new Handler(); // Get the main UI handler for posting update events DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); Log.d(LOG_TAG, "Width: " + dm.widthPixels + " Height: " + dm.heightPixels + " Density: " + dm.density); mScreenHeight = dm.heightPixels; mScreenWidth = dm.widthPixels; mSlotWidth = mScreenWidth / SLOTS_PER_SCREEN; // Setup the random number generator mRandom = new Random(); mRandom.setSeed(System.currentTimeMillis()); // This is ok. We are not looking for cryptographically secure random here! mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); // Setup the background/foreground mBackgroundLayout = (LinearLayout) findViewById(R.id.background_layout); mBackgroundScroll = (HorizontalScrollView) findViewById(R.id.background_scroll); mForegroundLayout = (LinearLayout) findViewById(R.id.foreground_layout); mForegroundScroll = (HorizontalScrollView) findViewById(R.id.foreground_scroll); mBackgrounds = new Bitmap[6]; mBackgrounds2 = new Bitmap[6]; mExitTransitions = new Bitmap[6]; mEntryTransitions = new Bitmap[6]; // Need to vertically scale background to fit the screen. Checkthe image size // compared to screen size and scale appropriately. We will also use the matrix to translate // as we move through the level. Bitmap bmp = BitmapFactory.decodeResource(getResources(), BACKGROUNDS[0]); Log.d(LOG_TAG, "Bitmap Width: " + bmp.getWidth() + " Height: " + bmp.getHeight() + " Screen Width: " + dm.widthPixels + " Height: " + dm.heightPixels); mScaleY = (float) dm.heightPixels / (float) bmp.getHeight(); mScaleX = (float) (dm.widthPixels * 2) / (float) bmp.getWidth(); // Ensure that a single bitmap is 2 screens worth of time. (Stock xxhdpi image is 3840x1080) if ((mScaleX != 1.0f) || (mScaleY != 1.0f)) { Bitmap tmp = Bitmap.createScaledBitmap(bmp, mScreenWidth * 2, mScreenHeight, false); if (tmp != bmp) { bmp.recycle(); bmp = tmp; } } BackgroundLoadTask.createTwoBitmaps(bmp, mBackgrounds, mBackgrounds2, 0); // Load the initial background view addNextImages(0); addNextImages(0); mWoodObstacles = new TreeMap<Integer, Bitmap>(); mWoodObstacleList = new ArrayList<Integer>(); mWoodObstacleIndex = 0; // We need the bitmaps, so we do pre-load here synchronously. initObstaclesAndPreLoad(WOOD_OBSTACLES, 3, mWoodObstacles, mWoodObstacleList); mCaveObstacles = new TreeMap<Integer, Bitmap>(); mCaveObstacleList = new ArrayList<Integer>(); mCaveObstacleIndex = 0; initObstacles(CAVE_OBSTACLES, 2, mCaveObstacleList); mFactoryObstacles = new TreeMap<Integer, Bitmap>(); mFactoryObstacleList = new ArrayList<Integer>(); mFactoryObstacleIndex = 0; initObstacles(FACTORY_OBSTACLES, 2, mFactoryObstacleList); // Setup the elf mElf = (ImageView) findViewById(R.id.elf_image); mThrust = (ImageView) findViewById(R.id.thrust_image); mElfLayout = (LinearLayout) findViewById(R.id.elf_container); loadElfImages(); updateElf(false); // Elf should be the same height relative to the height of the screen on any platform. Matrix scaleMatrix = new Matrix(); mElfScale = ((float) dm.heightPixels * 0.123f) / (float) mElfBitmap.getHeight(); // On a 1920x1080 xxhdpi screen, this makes the elf 133 pixels which is the height of the drawable. scaleMatrix.preScale(mElfScale, mElfScale); mElf.setImageMatrix(scaleMatrix); mThrust.setImageMatrix(scaleMatrix); mElfPosX = (dm.widthPixels * 15) / 100; // 15% Into the screen mElfPosY = (dm.heightPixels - ((float) mElfBitmap.getHeight() * mElfScale)) / 2; // About 1/2 way down. mElfVelX = (float) dm.widthPixels / 3000.0f; // We start at 3 seconds for a full screen to scroll. mGravityAccelY = (float) (2 * dm.heightPixels) / (float) Math.pow((1.2 * 1000.0), 2.0); // a = 2*d/t^2 Where d = height in pixels and t = 1.2 seconds mThrustAccelY = (float) (2 * dm.heightPixels) / (float) Math.pow((0.7 * 1000.0), 2.0); // a = 2*d/t^2 Where d = height in pixels and t = 0.7 seconds // Setup the control view mControlView = findViewById(R.id.control_view); mGestureDetector = new GestureDetector(this, this); mGestureDetector.setIsLongpressEnabled(true); mGestureDetector.setOnDoubleTapListener(this); mScoreLabel = getString(R.string.score); mScoreText = (TextView) findViewById(R.id.score_text); mScoreText.setText("0"); mPlayPauseButton = (ImageView) findViewById(R.id.play_pause_button); mExit = (ImageView) findViewById(R.id.exit); // Is Tv? mIsTv = TvUtil.isTv(this); if (mIsTv) { mScoreText.setText(mScoreLabel + ": 0"); mPlayPauseButton.setVisibility(View.GONE); mExit.setVisibility(View.GONE); // move scoreLayout position to the Top-Right corner. View scoreLayout = findViewById(R.id.score_layout); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) scoreLayout.getLayoutParams(); params.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); final int marginTop = getResources().getDimensionPixelOffset(R.dimen.overscan_margin_top); final int marginLeft = getResources().getDimensionPixelOffset(R.dimen.overscan_margin_left); params.setMargins(marginLeft, marginTop, 0, 0); scoreLayout.setLayoutParams(params); scoreLayout.setBackground(null); scoreLayout.findViewById(R.id.score_text_seperator).setVisibility(View.GONE); } else { mPlayPauseButton.setEnabled(false); mPlayPauseButton.setOnClickListener(this); mExit.setOnClickListener(this); } mBigPlayButtonLayout = findViewById(R.id.big_play_button_layout); mBigPlayButtonLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // No interaction with the screen below this one. return true; } }); mBigPlayButton = (ImageButton) findViewById(R.id.big_play_button); mBigPlayButton.setOnClickListener(this); // For showing points when getting presents. mPlus100 = (ImageView) findViewById(R.id.plus_100); m100Anim = new AlphaAnimation(1.0f, 0.0f); m100Anim.setDuration(1000); m100Anim.setFillBefore(true); m100Anim.setFillAfter(true); mPlus500 = (ImageView) findViewById(R.id.plus_500); m500Anim = new AlphaAnimation(1.0f, 0.0f); m500Anim.setDuration(1000); m500Anim.setFillBefore(true); m500Anim.setFillAfter(true); // Get the obstacle layouts ready. No obstacles on the first screen of a level. // Prime with a screen full of obstacles. mObstacleLayout = (LinearLayout) findViewById(R.id.obstacles_layout); mObstacleScroll = (HorizontalScrollView) findViewById(R.id.obstacles_scroll); // Initialize the present bitmaps. These are used repeatedly so we keep them loaded. mGiftBoxes = new Bitmap[GIFT_BOXES.length]; for (int i = 0; i < GIFT_BOXES.length; i++) { mGiftBoxes[i] = BitmapFactory.decodeResource(getResources(), GIFT_BOXES[i]); } // Add starting obstacles. First screen has presents. Next 3 get obstacles. addFirstScreenPresents(); // addFinalPresentRun(); // This adds 2 screens of presents // addNextObstacles(0, 1); addNextObstacles(0, 3); // Setup the sound pool mSoundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0); mSoundPool.setOnLoadCompleteListener(this); mCrashSound1 = mSoundPool.load(this, R.raw.jp_crash_1, 1); mCrashSound2 = mSoundPool.load(this, R.raw.jp_crash_2, 1); mCrashSound3 = mSoundPool.load(this, R.raw.jp_crash_3, 1); mGameOverSound = mSoundPool.load(this, R.raw.jp_game_over, 1); mJetThrustSound = mSoundPool.load(this, R.raw.jp_jet_thrust, 1); mLevelUpSound = mSoundPool.load(this, R.raw.jp_level_up, 1); mScoreBigSound = mSoundPool.load(this, R.raw.jp_score_big, 1); mScoreSmallSound = mSoundPool.load(this, R.raw.jp_score_small, 1); mJetThrustStream = 0; if (!mMoviePlaying) { doCountdown(); } }
From source file:com.rbsoftware.pfm.personalfinancemanager.utils.Utils.java
/** * Checks if current device is buggy samsung * * @return true if current device is buggy samsung *///ww w .j a v a2s. c o m public static boolean isBrokenSamsungDevice() { return (Build.MANUFACTURER.equalsIgnoreCase("samsung") && Build.MODEL.toLowerCase().contains("j5") && isBetweenAndroidVersions(Build.VERSION_CODES.LOLLIPOP, Build.VERSION_CODES.LOLLIPOP_MR1)); }
From source file:com.nbplus.push.PushService.java
private void getFromServer(final String url) { if (mRequestBody == null) { String prefName = mContext.getApplicationContext().getPackageName() + "_preferences"; SharedPreferences prefs = mContext.getSharedPreferences(prefName, Context.MODE_PRIVATE); // load from preferences.. String deviceId = prefs.getString(PushConstants.KEY_DEVICE_ID, ""); if (StringUtils.isEmptyString(deviceId)) { deviceId = DeviceUtils.getDeviceIdByMacAddress(mContext); prefs.edit().putString(PushConstants.KEY_DEVICE_ID, deviceId).apply(); }//from w ww . j a va2 s . c o m GetPushInterfaceRequestBody reqBodyObj = new GetPushInterfaceRequestBody(); reqBodyObj.deviceId = deviceId; reqBodyObj.os = Build.VERSION.RELEASE; reqBodyObj.pushVersion = Integer.toString(BuildConfig.VERSION_CODE); reqBodyObj.vendor = Build.MANUFACTURER; reqBodyObj.model = DeviceUtils.getDeviceName(); reqBodyObj.os = Build.ID + " " + Build.VERSION.RELEASE; reqBodyObj.deviceType = "android"; Gson gson = new GsonBuilder().create(); mRequestBody = gson.toJson(reqBodyObj, new TypeToken<GetPushInterfaceRequestBody>() { }.getType()); } // RequestQueue requestQueue = Volley.newRequestQueue(mContext, new HurlStack() { // @Override // protected HttpURLConnection createConnection(URL url) throws IOException { // HttpURLConnection connection = super.createConnection(url); // // Fix for bug in Android runtime(!!!): // // https://code.google.com/p/android/issues/detail?id=24672 // connection.setRequestProperty("Accept-Encoding", ""); // // return connection; // } // }); final GsonRequest gsonRequest = new GsonRequest(Request.Method.POST, url, mRequestBody, PushInterfaceData.class, new Response.Listener<PushInterfaceData>() { @Override public void onResponse(PushInterfaceData response) { Log.d(TAG, ">>> get PushInterfaceData success !!!"); mApiRetryCount = 0; Message message = new Message(); message.what = PushConstants.HANDLER_MESSAGE_GET_PUSH_GATEWAY_DATA; message.obj = response; mHandler.sendMessage(message); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { /** * 2015.10.05 * 1? ? ?? . */ Log.d(TAG, ">>> get PushInterfaceData error... retry connection after 1 minutes..."); if (mPushRunnable.getState() != PushRunnable.State.Stopped) { mPushRunnable.releasePushClientSocket(false); } mHandler.removeMessages(PushConstants.HANDLER_MESSAGE_RETRY_MESSAGE); mHandler.sendEmptyMessageDelayed(PushConstants.HANDLER_MESSAGE_RETRY_MESSAGE, PushService.MILLISECONDS * PushService.mNextRetryPeriodTerm); } }); if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(mContext, new HurlStack() { @Override protected HttpURLConnection createConnection(URL url) throws IOException { HttpURLConnection connection = super.createConnection(url); // Fix for bug in Android runtime(!!!): // https://code.google.com/p/android/issues/detail?id=24672 connection.setRequestProperty("Accept-Encoding", ""); return connection; } }); } gsonRequest.setRetryPolicy(new DefaultRetryPolicy(20 * 1000, 3, 1.0f)); mRequestQueue.add(gsonRequest); }
From source file:org.thoughtcrime.securesms.logsubmit.SubmitLogFragment.java
private static String buildDescription(Context context) { final PackageManager pm = context.getPackageManager(); final StringBuilder builder = new StringBuilder(); builder.append("Time : ").append(System.currentTimeMillis()).append('\n'); builder.append("Device : ").append(Build.MANUFACTURER).append(" ").append(Build.MODEL).append(" (") .append(Build.PRODUCT).append(")\n"); builder.append("Android : ").append(VERSION.RELEASE).append(" (").append(VERSION.INCREMENTAL).append(", ") .append(Build.DISPLAY).append(")\n"); builder.append("ABIs : ").append(TextUtils.join(", ", getSupportedAbis())).append("\n"); builder.append("Memory : ").append(getMemoryUsage(context)).append("\n"); builder.append("Memclass: ").append(getMemoryClass(context)).append("\n"); builder.append("OS Host : ").append(Build.HOST).append("\n"); builder.append("App : "); try {/*from ww w . j a va 2 s. co m*/ builder.append(pm.getApplicationLabel(pm.getApplicationInfo(context.getPackageName(), 0))).append(" ") .append(pm.getPackageInfo(context.getPackageName(), 0).versionName).append("\n"); } catch (PackageManager.NameNotFoundException nnfe) { builder.append("Unknown\n"); } return builder.toString(); }
From source file:it.mb.whatshare.PairOutboundActivity.java
private String generateRandomSeed() { StringBuilder builder = new StringBuilder(); String whitespace = ""; Random gen = new Random(); // I know, it's 4 (half) bytes so I could stuff them into a single int, // but I'm lazy and er.. it's open to future larger keys? randomSeed = new ArrayList<Integer>(); for (int i = 0; i < 4; i++) { builder.append(whitespace);/*from w w w . jav a 2 s . c o m*/ int nextInt = gen.nextInt(128); builder.append(nextInt); randomSeed.add(nextInt); whitespace = " "; } builder.append(String.format(" %s %s", Utils.capitalize(Build.MANUFACTURER), Build.MODEL)); Utils.debug("stuffing this into the QR code: %s", builder.toString()); return builder.toString(); }
From source file:com.ternup.caddisfly.fragment.DetailsFragment.java
public void postResult(String folderName) { RequestParams params = new RequestParams(); TimeZone tz = TimeZone.getTimeZone("UTC"); final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); df.setTimeZone(tz);//from w w w.jav a 2 s.c o m final ArrayList<String> filePaths = FileUtils.getFilePaths(getActivity(), folderName, "/small/", mLocationId); File myFile = new File(filePaths.get(0)); String date = df.format(DateUtils.getDateFromFilename(myFile.getName())); params.put("date", date); String deviceId = Build.MANUFACTURER + " " + Build.MODEL; if (deviceId.length() > 32) { deviceId = deviceId.substring(1, 32); } params.put("deviceId", deviceId); params.put("type", String.valueOf(mTestTypeId + 1)); if (wakeLock == null || !wakeLock.isHeld()) { PowerManager pm = (PowerManager) getActivity().getApplicationContext() .getSystemService(Context.POWER_SERVICE); wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "MyWakeLock"); wakeLock.acquire(); } WebClient.post("tests", params, new AsyncHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { String response = responseBody == null ? null : new String(responseBody); try { JSONObject json = new JSONObject(response); final int newId = json.getInt("id"); if (filePaths.size() > 0) { count = 0; totalCount = filePaths.size(); postItem(newId, filePaths); } } catch (JSONException e) { e.printStackTrace(); } } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, final Throwable error) { Log.d(Globals.DEBUG_TAG, "fail: " + error.getMessage()); getActivity().runOnUiThread(new Runnable() { public void run() { if (progressDialog != null) { progressDialog.dismiss(); } if (wakeLock != null && wakeLock.isHeld()) { wakeLock.release(); } AlertUtils.showAlert(getActivity(), R.string.error, error.getMessage(), R.string.ok, null, null); } }); } }); }
From source file:at.aec.solutions.checkmkagent.AgentService.java
private void writeDMIDecode(PrintWriter _out) { _out.write("<<<dmi_sysinfo>>>" + NEWLINE); _out.write("System Information" + NEWLINE); _out.write(" Manufacturer: " + Build.MANUFACTURER + " (" + Build.BRAND + ")" + NEWLINE); _out.write(" Product Name: " + Build.MODEL + NEWLINE); _out.write(" Version: " + Build.VERSION.RELEASE + NEWLINE); _out.write(" Serial Number: " + Build.DISPLAY + NEWLINE); TelephonyManager tManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String uuid = tManager.getDeviceId(); _out.write(" UUID: " + uuid + NEWLINE); _out.write(" Radio Version: " + Build.getRadioVersion() + NEWLINE); _out.write(" Wake-up Type: Power Switch" + NEWLINE); _out.write(" SKU Number: Not Specified" + NEWLINE); _out.write(" Family: Not Specified" + NEWLINE); }