public static String findDeviceID(Context context) { final String android_id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); if (android_id != null) { return android_id; } else { String m_szDevIDShort = "35" + // we make this look like a valid IMEI Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; // 13 digits return m_szDevIDShort; } }
public static boolean shouldEnableCacheOnMemory() { if (Build.MODEL.equalsIgnoreCase("GT-N7100") || (Build.MANUFACTURER.equalsIgnoreCase("SAMSUNG") && android.os.Build.VERSION.RELEASE.equalsIgnoreCase("4.4.2"))) { return false; } return true; }
public static boolean isBlackBerry() { boolean bb = false; if (android.os.Build.MODEL.contains("BlackBerry") || android.os.Build.BRAND.contains("BlackBerry") || android.os.Build.MANUFACTURER.contains("BlackBerry")) { bb = true; } return bb; }
public FREObject call(FREContext context, FREObject[] args) { if (Build.MANUFACTURER.equals("Amazon")) { Log.d(TAG, "push notifications disabled on amazon devices, ignoring unregister"); return null; } PushWoosh.getInstance().PushWooshNotificationUnRegister(context.getActivity()); return null; }
/** * 设置标题 @Title: setTitle * * @param actionBar * @param spannableString */ @TargetApi(11) public static void setTitle(ActionBar actionBar, SpannableString spannableString) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN && Build.MANUFACTURER.toUpperCase().equals("LGE")) { actionBar.setTitle(spannableString.toString()); } else { actionBar.setTitle(spannableString); } }
public static String getUniqueId(Context c) { String m_szImei = ""; // 1 compute IMEI try { TelephonyManager TelephonyMgr = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE); m_szImei = TelephonyMgr.getDeviceId(); // Requires READ_PHONE_STATE } catch (Exception e) { } // 2 compute DEVICE ID String m_szDevIDShort = "35" + // we make this look like a valid IMEI Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; // 13 digits if (m_szDevIDShort == null) m_szDevIDShort = ""; // 3 android ID - unreliable String m_szAndroidID = Secure.getString(c.getContentResolver(), Secure.ANDROID_ID); if (m_szAndroidID == null) m_szAndroidID = ""; // 6 SUM THE IDs String m_szLongID = m_szImei + m_szDevIDShort + m_szAndroidID; MessageDigest m = null; try { m = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } m.update(m_szLongID.getBytes(), 0, m_szLongID.length()); byte p_md5Data[] = m.digest(); String m_szUniqueID = new String(); for (int i = 0; i < p_md5Data.length; i++) { int b = (0xFF & p_md5Data[i]); // if it is a single digit, make sure it have 0 in front (proper padding) if (b <= 0xF) m_szUniqueID += "0"; // add number to string m_szUniqueID += Integer.toHexString(b); } m_szUniqueID = m_szUniqueID.toUpperCase(); return m_szUniqueID; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_reminders, menu); final MenuItem searchItem = menu.findItem(R.id.action_search); if (android.os.Build.MANUFACTURER.equals("samsung")) { searchItem.setVisible(false); } SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.addOnAttachStateChangeListener( new View.OnAttachStateChangeListener() { @Override public void onViewDetachedFromWindow(View arg0) { ExpAdapter.removeFilter(); // fix collapsed groups for (int i = 0; i < ExpAdapter.getGroupCount(); i++) { expandableListView.expandGroup(i); } } @Override public void onViewAttachedToWindow(View arg0) { ExpAdapter.searchStarted(); } }); searchView.setOnQueryTextListener( new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { ExpAdapter.filter(newText); // fix collapsed groups for (int i = 0; i < ExpAdapter.getGroupCount(); i++) { expandableListView.expandGroup(i); } return true; } }); return super.onCreateOptionsMenu(menu); }
static { com.unity3d.player.q.a = false; A = (Build.MANUFACTURER.equalsIgnoreCase("Amazon") && (Build.MODEL.equalsIgnoreCase("KFTT") || Build.MODEL.equalsIgnoreCase("KFJWI") || Build.MODEL.equalsIgnoreCase("KFJWA") || Build.MODEL.equalsIgnoreCase("KFSOWI") || Build.MODEL.equalsIgnoreCase("KFTHWA") || Build.MODEL.equalsIgnoreCase("KFTHWI") || Build.MODEL.equalsIgnoreCase("KFAPWA") || Build.MODEL.equalsIgnoreCase("KFAPWI"))); }
public void DD() throws FailedExecuteCommand, IOException, InterruptedException { String Command = ""; if (isJobFlash() || isJobRestore()) { if (mDevice.getName().startsWith("g2") && Build.MANUFACTURER.equals("lge") && isJobFlash()) { File aboot = new File("/dev/block/platform/msm_sdcc.1/by-name/aboot"); File extracted_aboot = new File(mContext.getFilesDir(), "aboot.img"); File patched_CustomIMG = new File(mContext.getFilesDir(), CustomIMG.getName() + ".lok"); File loki_patch = new File(mContext.getFilesDir(), "loki_patch"); File loki_flash = new File(mContext.getFilesDir(), "loki_flash"); mShell.execCommand( "dd if=" + aboot.getAbsolutePath() + " of=" + extracted_aboot.getAbsolutePath(), true); mShell.execCommand( loki_patch.getAbsolutePath() + " recovery " + CustomIMG.getAbsolutePath() + " " + patched_CustomIMG.getAbsolutePath() + " || exit 1", true); Command = loki_flash.getAbsolutePath() + " recovery " + patched_CustomIMG.getAbsolutePath() + " || exit 1"; } else { Log.i(TAG, "Flash started!"); Common.copyFile(CustomIMG, tmpFile); Command = busybox.getAbsolutePath() + " dd if=\"" + tmpFile.getAbsolutePath() + "\" " + "of=\"" + CurrentPartition.getAbsolutePath() + "\""; } } else if (isJobBackup()) { Log.i(TAG, "Backup started!"); Command = busybox.getAbsolutePath() + " dd if=\"" + CurrentPartition.getAbsolutePath() + "\" " + "of=\"" + tmpFile.getAbsolutePath() + "\""; } mShell.execCommand(Command, true); if (isJobBackup()) placeImgBack(); }
private DeviceUtils(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); IMEI = tm.getDeviceId(); IMSI = tm.getSubscriberId(); // for GSM phone only TODO TEL = tm.getLine1Number(); // maybe null WLAN_MAC = wm.getConnectionInfo().getMacAddress(); BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (null != bluetoothAdapter) { BLUETOOTH_MAC = bluetoothAdapter.getAddress(); } sDeviceManufacturer = Build.MANUFACTURER.toLowerCase(); Log.d(TAG, "sDeviceManufacturer:" + sDeviceManufacturer); Log.d(TAG, "pseudoID:" + PseudoID); }
/** sets the Orientation of the camera Preview o be the same as MoSyncApp */ private void setCameraDisplayOrientation() { // Use reflection to correct the preview on 2.2 and higher versions try { mCameraDisplayOrientation = mCamera.getClass().getMethod("setDisplayOrientation", Integer.TYPE); // Set the orientation of the picture on old Android phones Camera.Parameters parameters = mCamera.getParameters(); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { parameters.set("orientation", "portrait"); // default camera orientation on android is landscape // So we need to rotate the preview parameters.setRotation(90); mCamera.setDisplayOrientation(90); } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { parameters.set("orientation", "landscape"); parameters.setRotation(0); mCamera.setDisplayOrientation(0); } mCamera.setParameters(parameters); } catch (NoSuchMethodException nsme) { SYSLOG("ANDROID Version is less than 2.2!!"); // Set the orientation of the picture on old Android phones Camera.Parameters parameters = mCamera.getParameters(); // an Ugly hack to make HTC wildfire work if (Build.MANUFACTURER.equals("HTC")) { parameters.set("orientation", "landscape"); parameters.setRotation(90); } // rest of the phones work fine with the standard settings else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { parameters.set("orientation", "portrait"); parameters.setRotation(90); } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { parameters.set("orientation", "landscape"); parameters.setRotation(0); } mCamera.setParameters(parameters); } catch (RuntimeException e) { SYSLOG("Failed to set camera Parameters"); } }
private void onFirstRefresh() { ((PreferenceButton) findViewById(R.id.kernelVersion)) .setValue(HKMTools.getFormattedKernelVersion()); ((PreferenceButton) findViewById(R.id.cpuArch)) .setValue( HKMTools.getCpuArchitecture() + (Build.SUPPORTED_64_BIT_ABIS.length > 0 ? "\n[x64]" : "\n[x86]")); ((PreferenceButton) findViewById(R.id.deviceInfo)) .setValue( Build.MANUFACTURER .concat("/") .concat(Build.MODEL) .concat("/") .concat(Build.DEVICE) .concat("/") .concat(Build.BOOTLOADER)); }
public static String getPath(Context context) { String url; Boolean isSDPresent = android.os.Environment.getExternalStorageState() .equals(android.os.Environment.MEDIA_MOUNTED); if (isSDPresent) { url = Environment.getExternalStorageDirectory().getAbsolutePath(); if (android.os.Build.DEVICE.contains("Samsung") || android.os.Build.MANUFACTURER.contains("Samsung")) { url = url + "/external_sd"; } // url = url + "/" + context.getString(R.string.app_name); url = url + "/ownCloud News Reader"; } else url = context.getCacheDir().getAbsolutePath(); return url; }
@Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.dialog_about); // Header Resources res = mContext.getResources(); String appName = res.getString(R.string.app_name); TextView title = (TextView) findViewById(R.id.title); title.setText("About " + appName); // Application info TextView head = (TextView) findViewById(R.id.header); String appVersion = "Revision: "; try { appVersion += mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { Log.v(TAG, e.getMessage()); } head.setText(appVersion); // From About.html web page WebView wv = (WebView) findViewById(R.id.content); wv.loadUrl("file:///android_asset/about.html"); // Dismiss button Button okButton = (Button) findViewById(R.id.buttonOK); okButton.setOnClickListener(mOkListener); // Device information TextView foot = (TextView) findViewById(R.id.footer); String txt = Build.MANUFACTURER.toUpperCase() + " " + Build.MODEL + " Android " + Build.VERSION.RELEASE + " " + Build.DISPLAY; foot.setText(txt); }
private void initializePreferenceDisplay() { // XXX-S Why are there two separate if blocks to do this? Merely setting these UI elements to // "checked" won't necessarily change the underlying preferences, and it won't have any // effect until this activity is opened. if (DeviceAudioSettings.useInCallMode()) { CheckBoxPreference speakerPreference = (CheckBoxPreference) this.findPreference(AUDIO_SPEAKER_INCALL); speakerPreference.setChecked(true); } if (Build.MANUFACTURER.equals("Samsung")) { CheckBoxPreference speakerPreference = (CheckBoxPreference) this.findPreference(AUDIO_SPEAKER_INCALL); speakerPreference.setChecked(false); } if (Build.VERSION.SDK_INT < 8) ((CheckBoxPreference) findPreference(USE_C2DM)).setEnabled(false); }
public String pidxor(String pid) { String deviceId = "35" + Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; // Library calls this when it's done. return xorTxt(pid, deviceId); }
/** * Tries to figure out if the current phone is Galaxy S based, since it has recording issues This * is pretty nasty since we are string matching, but unless I can get a better way to do it... * * @param */ public static boolean isSamsungGalaxyS() { String manufacturer = android.os.Build.MANUFACTURER.toLowerCase(); String model = android.os.Build.MODEL.toLowerCase(); String device = android.os.Build.DEVICE.toLowerCase(); Log.i( TAG_AUDIOHELPER, String.format("manufacturer: %s, model: %s, device: %s", manufacturer, model, device)); if (manufacturer.equals(MANUFACTURER_SAMSUNG)) { if (device.equals(DEVICE_ID_GALAXY_S)) { Log.i(TAG_AUDIOHELPER, "Samsung Galaxy S detected"); return true; } if (device.equals(DEVICE_ID_CAPTIVATE)) { Log.i(TAG_AUDIOHELPER, "ATT, Samsung Captivate detected"); return true; } if (device.equals(DEVICE_ID_VIBRANT)) { Log.i(TAG_AUDIOHELPER, "T-Mobile US, Samsung Vibrant detected"); return true; } if (device.equals(DEVICE_ID_EPIC)) { Log.i(TAG_AUDIOHELPER, "Sprint, Samsung Epic 4G detected"); return true; } if (device.equals(DEVICE_ID_FASCINATE)) { Log.i(TAG_AUDIOHELPER, "Verizon, Samsung Fascinate detected"); return true; } if (device.equals(DEVICE_ID_MESMERIZE)) { Log.i(TAG_AUDIOHELPER, "Samsung Mesmerize detected"); return true; } } return false; }
@Override public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable { if (lpparam.packageName.equals("android")) { if (android.os.Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains("samsung")) new SViewHooks(this, lpparam.classLoader); } if (lpparam.packageName.equals("com.htc.launcher")) { HtcTransparencyHook.doBlinkFeedHooks(lpparam.classLoader); } if (lpparam.packageName.equals("com.htc.lockscreen")) { HtcTransparencyHook.doLockscreenHooks(lpparam.classLoader); } if (!lpparam.packageName.equals("com.android.systemui")) return; mGradientDrawable = new OverlayDrawable(mResources, Color.TRANSPARENT, R.drawable.status_background); if (mHookClockOnSystemUiInit) doClockHooks(lpparam.classLoader); mSystemUiClassLoader = lpparam.classLoader; new StatusBarHook(this, lpparam.classLoader); new StatusBarViewHook(this, lpparam.classLoader); new NavigationBarHook(this, lpparam.classLoader); new BatteryHooks(this, lpparam.classLoader); new SignalClusterHook(this, lpparam.classLoader); new BluetoothControllerHook(this, lpparam.classLoader); new TickerHooks(this, lpparam.classLoader); new KeyButtonViewHook(this, lpparam.classLoader); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { new KitKatBatteryHook(this, lpparam.classLoader); } CustomRomHooks.doHook(lpparam.classLoader, this); HtcTransparencyHook.doHook(lpparam.classLoader); LGHooks.doHook(lpparam.classLoader); SamsungHook.doHook(this, lpparam.classLoader); }
public final String a(TidInfo paramTidInfo) { Context localContext = GlobalContext.a().b(); Object localObject4 = DeviceInfo.a(localContext); if (TextUtils.isEmpty(this.e)) { localObject1 = Utils.a(); localObject2 = Utils.b(); localObject3 = Utils.d(localContext); str1 = Utils.c(); str2 = Utils.e(localContext); str3 = Float.toString(new TextView(localContext).getTextSize()); this.e = ("Msp/9.1.8" + " (" + (String)localObject1 + ";" + (String)localObject2 + ";" + (String)localObject3 + ";" + str1 + ";" + str2 + ";" + str3); } String str1 = DeviceInfo.b(localContext).a(); String str2 = Utils.f(localContext); String str3 = ((DeviceInfo)localObject4).a(); String str4 = ((DeviceInfo)localObject4).b(); Object localObject5 = GlobalContext.a().b(); Object localObject3 = ((Context)localObject5).getSharedPreferences("virtualImeiAndImsi", 0); Object localObject1 = ((SharedPreferences)localObject3).getString("virtual_imsi", null); Object localObject2 = localObject1; Object localObject6; label325: boolean bool; String str5; if (TextUtils.isEmpty((CharSequence)localObject1)) { if (!TextUtils.isEmpty(TidInfo.c().a())) break label717; localObject1 = GlobalContext.a().g(); if (TextUtils.isEmpty((CharSequence)localObject1)) { localObject1 = f(); ((SharedPreferences)localObject3).edit().putString("virtual_imsi", (String)localObject1).commit(); localObject2 = localObject1; } } else { localObject6 = GlobalContext.a().b(); localObject5 = ((Context)localObject6).getSharedPreferences("virtualImeiAndImsi", 0); localObject3 = ((SharedPreferences)localObject5).getString("virtual_imei", null); localObject1 = localObject3; if (TextUtils.isEmpty((CharSequence)localObject3)) { if (!TextUtils.isEmpty(TidInfo.c().a())) break label729; localObject1 = f(); ((SharedPreferences)localObject5).edit().putString("virtual_imei", (String)localObject1).commit(); } if (paramTidInfo != null) this.g = paramTidInfo.b(); localObject5 = Build.MANUFACTURER.replace(";", " "); localObject6 = Build.MODEL.replace(";", " "); bool = GlobalContext.e(); str5 = ((DeviceInfo)localObject4).c(); localObject3 = ((WifiManager)localContext.getSystemService("wifi")).getConnectionInfo(); if (localObject3 == null) break label741; localObject3 = ((WifiInfo)localObject3).getSSID(); label421: localObject4 = ((WifiManager)localContext.getSystemService("wifi")).getConnectionInfo(); if (localObject4 == null) break label748; } label717: label729: label741: label748: for (localObject4 = ((WifiInfo)localObject4).getBSSID(); ; localObject4 = "00") { StringBuilder localStringBuilder = new StringBuilder(); localStringBuilder.append(this.e).append(";").append(str1).append(";").append(str2).append(";").append("1").append(";").append(str3).append(";").append(str4).append(";").append(this.g).append(";").append((String)localObject5).append(";").append((String)localObject6).append(";").append(bool).append(";").append(str5).append(";").append(UserLocation.a()).append(";").append(this.f).append(";").append((String)localObject2).append(";").append((String)localObject1).append(";").append((String)localObject3).append(";").append((String)localObject4); if (paramTidInfo != null) { localObject1 = new HashMap(); ((HashMap)localObject1).put("tid", paramTidInfo.a()); ((HashMap)localObject1).put("utdid", GlobalContext.a().g()); paramTidInfo = SecurityClientMobile.GetApdid(localContext, (Map)localObject1); if (!TextUtils.isEmpty(paramTidInfo)) localStringBuilder.append(";").append(paramTidInfo); } localStringBuilder.append(")"); return localStringBuilder.toString(); localObject1 = ((String)localObject1).substring(3, 18); break; localObject1 = DeviceInfo.a((Context)localObject5).a(); break; localObject1 = DeviceInfo.a((Context)localObject6).b(); break label325; localObject3 = "-1"; break label421; } }
@SuppressLint("SetJavaScriptEnabled") @SuppressWarnings("deprecation") private void initWebViewSettings() { this.setInitialScale(0); this.setVerticalScrollBarEnabled(false); // TODO: The Activity is the one that should call requestFocus(). if (shouldRequestFocusOnInit()) { this.requestFocusFromTouch(); } this.setInitialScale(0); this.setVerticalScrollBarEnabled(false); if (shouldRequestFocusOnInit()) { this.requestFocusFromTouch(); } // Enable JavaScript final WebSettings settings = this.getSettings(); settings.setJavaScriptEnabled(true); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL); // Set the nav dump for HTC 2.x devices (disabling for ICS, deprecated entirely for Jellybean // 4.2) try { Method gingerbread_getMethod = WebSettings.class.getMethod("setNavDump", new Class[] {boolean.class}); String manufacturer = android.os.Build.MANUFACTURER; Log.d(TAG, "CordovaWebView is running on device made by: " + manufacturer); if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB && android.os.Build.MANUFACTURER.contains("HTC")) { gingerbread_getMethod.invoke(settings, true); } } catch (NoSuchMethodException e) { Log.d(TAG, "We are on a modern version of Android, we will deprecate HTC 2.3 devices in 2.8"); } catch (IllegalArgumentException e) { Log.d(TAG, "Doing the NavDump failed with bad arguments"); } catch (IllegalAccessException e) { Log.d( TAG, "This should never happen: IllegalAccessException means this isn't Android anymore"); } catch (InvocationTargetException e) { Log.d( TAG, "This should never happen: InvocationTargetException means this isn't Android anymore."); } // We don't save any form data in the application settings.setSaveFormData(false); settings.setSavePassword(false); // Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist // while we do this if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { Level16Apis.enableUniversalAccess(settings); } if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { Level17Apis.setMediaPlaybackRequiresUserGesture(settings, false); } // Enable database // We keep this disabled because we use or shim to get around DOM_EXCEPTION_ERROR_16 String databasePath = getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); settings.setDatabaseEnabled(true); settings.setDatabasePath(databasePath); // Determine whether we're in debug or release mode, and turn on Debugging! ApplicationInfo appInfo = getContext().getApplicationContext().getApplicationInfo(); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { enableRemoteDebugging(); } settings.setGeolocationDatabasePath(databasePath); // Enable DOM storage settings.setDomStorageEnabled(true); // Enable built-in geolocation settings.setGeolocationEnabled(true); // Enable AppCache // Fix for CB-2282 settings.setAppCacheMaxSize(5 * 1048576); settings.setAppCachePath(databasePath); settings.setAppCacheEnabled(true); // Fix for CB-1405 // Google issue 4641 settings.getUserAgentString(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); if (this.receiver == null) { this.receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { settings.getUserAgentString(); } }; getContext().registerReceiver(this.receiver, intentFilter); } // end CB-1405 }
@Kroll.method public void showCamera(@SuppressWarnings("rawtypes") HashMap options) { Activity activity = TiApplication.getInstance().getCurrentActivity(); Log.d(TAG, "showCamera called", Log.DEBUG_MODE); KrollFunction successCallback = null; KrollFunction cancelCallback = null; KrollFunction errorCallback = null; boolean autohide = true; boolean saveToPhotoGallery = false; if (options.containsKey("success")) { successCallback = (KrollFunction) options.get("success"); } if (options.containsKey("cancel")) { cancelCallback = (KrollFunction) options.get("cancel"); } if (options.containsKey("error")) { errorCallback = (KrollFunction) options.get("error"); } Object autohideOption = options.get("autohide"); if (autohideOption != null) { autohide = TiConvert.toBoolean(autohideOption); } Object saveToPhotoGalleryOption = options.get("saveToPhotoGallery"); if (saveToPhotoGalleryOption != null) { saveToPhotoGallery = TiConvert.toBoolean(saveToPhotoGalleryOption); } // Use our own custom camera activity when an overlay is provided. if (options.containsKey("overlay")) { TiCameraActivity.overlayProxy = (TiViewProxy) options.get("overlay"); TiCameraActivity.callbackContext = getKrollObject(); TiCameraActivity.successCallback = successCallback; TiCameraActivity.errorCallback = errorCallback; TiCameraActivity.cancelCallback = cancelCallback; TiCameraActivity.saveToPhotoGallery = saveToPhotoGallery; TiCameraActivity.whichCamera = CAMERA_REAR; // default. // This option is only applicable when running the custom // TiCameraActivity, since we can't direct the built-in // Activity to open a specific camera. Object whichCamera = options.get("whichCamera"); if (whichCamera != null) { TiCameraActivity.whichCamera = TiConvert.toInt(whichCamera); } TiCameraActivity.autohide = autohide; Intent intent = new Intent(activity, TiCameraActivity.class); activity.startActivity(intent); return; } Camera camera = null; try { camera = Camera.open(); if (camera != null) { camera.release(); camera = null; } } catch (Throwable t) { if (camera != null) { camera.release(); } if (errorCallback != null) { errorCallback.call( getKrollObject(), new Object[] {createErrorResponse(NO_CAMERA, "Camera not available.")}); } return; } TiActivitySupport activitySupport = (TiActivitySupport) activity; TiFileHelper tfh = TiFileHelper.getInstance(); TiIntentWrapper cameraIntent = new TiIntentWrapper(new Intent()); if (TiCameraActivity.overlayProxy == null) { cameraIntent.getIntent().setAction(MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.getIntent().addCategory(Intent.CATEGORY_DEFAULT); } else { cameraIntent .getIntent() .setClass(TiApplication.getInstance().getBaseContext(), TiCameraActivity.class); } cameraIntent.setWindowId(TiIntentWrapper.createActivityName("CAMERA")); PackageManager pm = (PackageManager) activity.getPackageManager(); List<ResolveInfo> activities = pm.queryIntentActivities(cameraIntent.getIntent(), PackageManager.MATCH_DEFAULT_ONLY); // See if it's the HTC camera app boolean isHTCCameraApp = false; for (ResolveInfo rs : activities) { try { if (rs.activityInfo.applicationInfo.sourceDir.contains("HTC") || Build.MANUFACTURER.equals("HTC")) { isHTCCameraApp = true; break; } } catch (NullPointerException e) { // Ignore } } File imageDir = null; File imageFile = null; try { if (saveToPhotoGallery) { // HTC camera application will create its own gallery image // file. if (!isHTCCameraApp) { imageFile = createGalleryImageFile(); } } else { if (activity.getIntent() != null) { String name = TiApplication.getInstance().getAppInfo().getName(); // For HTC cameras, specifying the directory from // getExternalStorageDirectory is /mnt/sdcard and // using that path prevents the gallery from recognizing it. // To avoid this we use /sdcard instead // (this is a legacy path we've been using) if (isHTCCameraApp) { imageDir = new File(PHOTO_DCIM_CAMERA, name); } else { File rootsd = Environment.getExternalStorageDirectory(); imageDir = new File(rootsd.getAbsolutePath() + "/dcim/Camera/", name); } if (!imageDir.exists()) { imageDir.mkdirs(); if (!imageDir.exists()) { Log.w(TAG, "Attempt to create '" + imageDir.getAbsolutePath() + "' failed silently."); } } } else { imageDir = tfh.getDataDirectory(false); } imageFile = tfh.getTempFile(imageDir, ".jpg", true); } } catch (IOException e) { Log.e(TAG, "Unable to create temp file", e); if (errorCallback != null) { errorCallback.callAsync( getKrollObject(), createErrorResponse(UNKNOWN_ERROR, e.getMessage())); } return; } // Get the taken date for the last image in EXTERNAL_CONTENT_URI. String[] projection = {Images.ImageColumns.DATE_TAKEN}; String dateTaken = null; Cursor c = activity .getContentResolver() .query( Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, Images.ImageColumns.DATE_TAKEN); if (c != null) { if (c.moveToLast()) { dateTaken = c.getString(0); } c.close(); c = null; } CameraResultHandler resultHandler = new CameraResultHandler(); resultHandler.imageFile = imageFile; resultHandler.saveToPhotoGallery = saveToPhotoGallery; resultHandler.successCallback = successCallback; resultHandler.cancelCallback = cancelCallback; resultHandler.errorCallback = errorCallback; resultHandler.activitySupport = activitySupport; resultHandler.cameraIntent = cameraIntent.getIntent(); resultHandler.dateTaken_lastImageInExternalContentURI = dateTaken; if (imageFile != null) { String imageUrl = "file://" + imageFile.getAbsolutePath(); cameraIntent.getIntent().putExtra(MediaStore.EXTRA_OUTPUT, Uri.parse(imageUrl)); resultHandler.imageUrl = imageUrl; } activity.runOnUiThread(resultHandler); }
private static String getManufacturer() { return android.os.Build.MANUFACTURER.toLowerCase(Locale.ENGLISH); }
private void deviceCheck() { Const.IS_KINDLE = Build.MANUFACTURER.equalsIgnoreCase("Amazon"); }
/** * @author ifay 单例使用 * <p>提供设备唯一标识 提供设备基本信息:OS,Version,Name 第一次使用,将设备ID记录到sharedPreference中?? 判断是否root */ public class DeviceUtils { private static final String TAG = "DeviceUtils"; private static ExecutorService pool = Executors.newCachedThreadPool(); private static String sDeviceID = null; private static DeviceUtils sInstance = null; // IMEI,IMSI 二选一 private static String IMEI = null; // device id: 对于三星测试机正确,对于htc显式的是MEID,15位 private static String IMSI = null; private static String TEL = null; private static String WLAN_MAC = null; // 形如00:11:22:33:44:55,易被伪造 private static String BLUETOOTH_MAC = null; // 仅支持有蓝牙的设备 private static String sDeviceManufacturer = null; private static String sDeviceOS = Build.VERSION.RELEASE; // 根据ROM版本、制造商、CPU等硬件信息制作的伪ID,相同的硬件及ROM镜像时 public static String PseudoID = "35" + Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; public static boolean isDeviceComplianced = false; public static DeviceUtils getInstance(Context context) { if (sInstance == null) { sInstance = new DeviceUtils(context); } return sInstance; } private DeviceUtils(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); IMEI = tm.getDeviceId(); IMSI = tm.getSubscriberId(); // for GSM phone only TODO TEL = tm.getLine1Number(); // maybe null WLAN_MAC = wm.getConnectionInfo().getMacAddress(); BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (null != bluetoothAdapter) { BLUETOOTH_MAC = bluetoothAdapter.getAddress(); } sDeviceManufacturer = Build.MANUFACTURER.toLowerCase(); Log.d(TAG, "sDeviceManufacturer:" + sDeviceManufacturer); Log.d(TAG, "pseudoID:" + PseudoID); } /** MD5方法计算DeviceID 产生32位的16进制数据,总长为 */ public String getsDeviceIdMD5() { String longID = IMEI + IMSI + TEL + WLAN_MAC + BLUETOOTH_MAC; sDeviceID = CommonUtils.cryptMD5(longID); return sDeviceID; } /** SHA1方法计算DeviceID */ public String getsDeviceIdSHA1() { // if (sDeviceID == null || sDeviceID.length() < 1) { // Log.d(TAG,"IMEI"+IMEI); // Log.d(TAG,"IMSI"+IMSI); // Log.d(TAG,"TEL"+TEL); // Log.d(TAG,"WLAN_MAC"+WLAN_MAC); // Log.d(TAG,"BLUETOOTH_MAC"+BLUETOOTH_MAC); // String longID = IMEI + IMSI + TEL + WLAN_MAC + BLUETOOTH_MAC; // longID.replaceAll(":", ""); // Log.d(TAG,"longID"+longID); // sDeviceID = CommonUtils.cryptSH1(longID); // } sDeviceID = PseudoID; return sDeviceID; } public String getIMEI() { return IMEI; } public String getIMSI() { return IMSI; } public String getTEL() { return TEL; } public String getWLAN_MAC() { return WLAN_MAC; } public String getBLUETOOTH_MAC() { return BLUETOOTH_MAC; } public String getPseudoID() { return PseudoID; } /** * 对设备进行合规性检测 将设备信息发送至服务器,由服务器进行检测 * * @param context * @return null通过。"字符串"-未通过某条策略 * @throws Exception */ public static String isDeviceComplianced(Context context) throws Exception { return PolicyUtils.checkPolicy(context); } /** * 向服务器查询用户所有设备数目 * * @param userAccount 用户账户唯一标识,此处用邮箱 * @return 用户所绑定的设备数目. -1表示密码错误 * @throws Exception */ public static int getUserDeviceNum(String userAccount, String userPwd) throws Exception { PropertyInfo[] property = new PropertyInfo[2]; property[0] = new PropertyInfo(); property[0].setName("userAccount"); property[0].setValue(userAccount); property[0].setType(PropertyInfo.STRING_CLASS); property[1] = new PropertyInfo(); property[1].setName("pwd"); property[1].setValue(userPwd); property[1].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "getUserDeviceNum", property); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); String result; try { result = future.get(); return Integer.parseInt(result); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } /** * 判断是否root * * @return */ public static boolean isRooted() { return RootTools.isRootAvailable() && RootTools.isAccessGiven(); } /** * 检测是否锁定 * * @return false:not locked; true:locked * @throws InterruptedException * @throws ExecutionException */ public boolean isDeviceLocked() throws Exception { if (sDeviceID == null || sDeviceID.length() < 1) { getsDeviceIdSHA1(); } PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceID"); propertyInfo[0].setValue(sDeviceID); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "isDeviceLocked", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); return result.equals("true"); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } /** 新设备注册前需要由其他已注册的设备同意 在registerDevice(context,false)的时候就已经完成 */ public boolean sendRegReqToPeerDevice() { return CommonUtils.SUCCESS; } /** * 向服务器查询设备注册请求是否已被批准 * * @return * @throws Exception */ public boolean isRegReqApproved() throws Exception { // send req to server, select by deviceiD String deviceID = getsDeviceIdSHA1(); PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceID"); propertyInfo[0].setValue(deviceID); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "isDeviceActive", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); return result.equals("true"); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } public JSONStringer generateDeviceJSON(Context context, boolean isFirst, String userAccount) { LocationUtils location = new LocationUtils(context); JSONStringer deviceJson = new JSONStringer(); try { deviceJson.object(); deviceJson.key("deviceid"); // deviceJson.value(getsDeviceIdSHA1()); deviceJson.value(getPseudoID()); deviceJson.key("useraccount"); deviceJson.value(userAccount); // /TODO deviceJson.key("devicename"); deviceJson.value(sDeviceManufacturer); deviceJson.key("devicetype"); deviceJson.value("1"); // 1手机 deviceJson.key("deviceos"); deviceJson.value(2000); // Android deviceJson.key("devicemac"); deviceJson.value(WLAN_MAC); deviceJson.key("devicephonenum"); deviceJson.value(TEL); deviceJson.key("deviceislock"); deviceJson.value(0); deviceJson.key("deviceisdel"); deviceJson.value(0); deviceJson.key("deviceinittime"); Date date = new Date(); deviceJson.value(date.getTime()); // TODO 日期格式 long型 deviceJson.key("devicevalidperiod"); deviceJson.value(365); // //TODO 暂定365天有效。服务器需要支持修改 deviceJson.key("deviceisillegal"); deviceJson.value(0); deviceJson.key("deviceisactive"); deviceJson.value(isFirst ? 1 : 0); // 第一台设备不做peer校验,直接注册 deviceJson.key("deviceislogout"); deviceJson.value(0); deviceJson.key("deviceeaster"); deviceJson.value(userAccount); deviceJson.key("bakstr1"); deviceJson.value(location.getLocation()); // TODO 目前是经度+空格+纬度 deviceJson.endObject(); Log.d(TAG, "JSON-----" + deviceJson.toString()); } catch (JSONException e) { e.printStackTrace(); } return deviceJson; } /** * 注册设备 , 同时发送Register request * * @return * @throws Exception */ public boolean registerDevice(Context context, boolean isFirst, String userAccount) throws Exception { // send device info to the server String deviceJson = generateDeviceJSON(context, isFirst, userAccount).toString(); if (deviceJson.length() == 0) { // Device info generate fail return CommonUtils.FAIL; } PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceJSON"); propertyInfo[0].setValue(deviceJson); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "deviceRegister", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); return result.equals("true"); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } /** * TODO 根据deviceID查询对应的userID下的 isActive为false的设备信息 * * @param deviceID * @return * @throws Exception */ public static String[] queryPeerDevices() throws Exception { // TODO query server use thread PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceID"); propertyInfo[0].setValue(PseudoID); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "queryPeerDevices", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); if (result == null) { return null; } JSONObject resultJson = new JSONObject(result); String[] resultSet = new String[] {"", ""}; resultSet[0] = resultJson.getString("DEVICEID"); resultSet[1] = resultJson.getString("DEVICENAME"); return resultSet; } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } catch (Exception e) { throw e; } } /** * 允许设备注册 将isActive置为true * * @param deviceID * @throws Exception */ public static boolean approvePeerDevice(String deviceID) throws Exception { PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceID"); propertyInfo[0].setValue(deviceID); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "setDeviceActive", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); return result.equals("true"); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } /** * 查询设备注册是否被批准 * * @return * @throws Exception */ public int checkRegRequestApproved() throws Exception { String deviceID = getsDeviceIdSHA1(); PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceID"); propertyInfo[0].setValue(sDeviceID); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "isDeviceActive", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); return Integer.parseInt(result); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } /** * 不允许设备注册 delete device 对应的userID字段 * * @param deviceID */ public static boolean disapproveDevice(String deviceID) throws Exception { PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceID"); propertyInfo[0].setValue(deviceID); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "disapproveDeviceRegister", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); return result.equals("true"); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } /** * 查询设备是否注册过 device记录存在,且isActive * * @return */ public boolean isDeviceRegistered() throws Exception { PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceID"); propertyInfo[0].setValue(getsDeviceIdSHA1()); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "isDeviceRegistered", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); return result.equals("true"); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } public static int getAPIVersion() { Log.d(TAG, "API version:" + Build.VERSION.SDK_INT); return Build.VERSION.SDK_INT; } public static boolean isWifiEnabled(Context context) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); return wifi.isWifiEnabled(); } public static boolean isGPRSEnabled(Context context) { ConnectivityManager connectMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); Log.d(TAG, "gprs:" + connectMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isAvailable()); return connectMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isAvailable(); } public static boolean isBlueToothEnabled(Context context) { // TODO Auto-generated method stub ConnectivityManager connectMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); return connectMgr.getNetworkInfo(ConnectivityManager.TYPE_BLUETOOTH).isAvailable(); } public static boolean isDeviceErased() throws Exception { PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceID"); propertyInfo[0].setValue(PseudoID); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "isDeviceErased", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); Log.d(TAG, "is erased: " + result); return result.equals("true"); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } /** @throws Exception */ public static void deleteOperationFinished() throws Exception { PropertyInfo[] propertyInfo = new PropertyInfo[1]; propertyInfo[0] = new PropertyInfo(); propertyInfo[0].setName("deviceID"); propertyInfo[0].setValue(PseudoID); propertyInfo[0].setType(PropertyInfo.STRING_CLASS); WebConnectCallable task = new WebConnectCallable( CommonUtils.IAM_URL, CommonUtils.IAM_NAMESPACE, "deviceEraseFinished", propertyInfo); if (pool == null) { pool = Executors.newCachedThreadPool(); } Future<String> future = pool.submit(task); try { String result = future.get(); } catch (InterruptedException e) { throw e; } catch (ExecutionException e) { throw e; } } }
public class Shared { // Singleton class to share data among activities public static String url = "http://api.yousendit.com.my/index.php/"; // AVD : http://10.0.2.2/, Genymotion : // http://10.0.3.2/ public static String loginkey = ""; public static String phpsessid = ""; public static String regexemail = "^[A-Za-z_]([A-Za-z\\d_]+\\.?)*[A-Za-z\\d_]+@([A-Za-z\\d_]+\\.?)+\\.[A-Za-z\\d_]+$"; public static String regexname = "^[A-Za-z\\s]{6,}$"; public static String regexpassword = "******"; public static String email; public static String projectkey = "298122460897"; public static String gcmid; public static String android; public static JSONObject listitems; public static SharedPreferences userpref, global; public static SharedPreferences.Editor editor; public static int id; public static Details details; // current job details public static String[] months = new String[] { "January", "February", "March", "April", "May", "Jun", "July", "August", "September", "October", "November", "December" }; public static boolean istransporter, haspayment; public static SimpleDateFormat sqldate = new SimpleDateFormat("yyyy-MM-dd"); public static SimpleDateFormat sqltime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static SimpleDateFormat userdate = new SimpleDateFormat("EEE, dd MMM yyyy"); public static SimpleDateFormat usertime = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm a"); public static SimpleDateFormat progresstime = new SimpleDateFormat("EEE, dd MMM hh:mm a"); public static SimpleDateFormat monthyear = new SimpleDateFormat("MMM yyyy"); public static SimpleDateFormat shortdate = new SimpleDateFormat("MMM dd, yy"); public static SimpleDateFormat longdate = new SimpleDateFormat("MMM dd, yyyy"); public static SimpleDateFormat monthdate = new SimpleDateFormat("MMM dd"); public static SimpleDateFormat timeonly = new SimpleDateFormat("hh:mm a"); public static SimpleDateFormat datetime = new SimpleDateFormat("MMM dd, yyyy hh:mm a"); public static boolean isSamsung = Build.MANUFACTURER.equalsIgnoreCase("SAMSUNG"); public static String[] countries, countriesbycode; public static HashMap<String, String> cctypes = new HashMap<String, String>(); public static String image, name; public static Context screen; static { cctypes.put("visa", "cciconvisa"); cctypes.put("americanexpress", "cciconamex"); cctypes.put("discover", "ccicondiscover"); cctypes.put("mastercard", "cciconmastercard"); cctypes.put("jcb", "cciconjcb"); String items = "{" + "location : ['PJ','USJ','Damansara','Shah Alam','Subang','Ampang','Cheras','Kajang','Gombak','Klang','Puchong','Bangsar']," + "type : ['Parcel','Document','Food','Vehicle']," + "size : ['Tiny','Small','Medium','Big']," + "urgency : ['Very urgent', 'I can wait', 'Take your time']," + "progress : ['Pick up','Delivered','Delay','Re-scheduled']," + "log : ['Pick up','Pick up verified','Pick up not verified','Delayed','Delivered','Re-scheduled']" + "}"; try { listitems = new JSONObject(items); } catch (JSONException ex) { // System.out.println(ex.getMessage()); } } }
/** @return true if the device is a kindle fire and needs special treatment */ public static boolean isKindleFire() { return android.os.Build.MANUFACTURER.equals("Amazon") && //$NON-NLS-1$ android.os.Build.MODEL.contains("Kindle"); // $NON-NLS-1$ }