android.telephony.TelephonyManager Java Examples
The following examples show how to use
android.telephony.TelephonyManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Dumper.java From SocietyPoisonerTrojan with GNU General Public License v3.0 | 7 votes |
public JSONObject dumpInfo (Context context) { JSONObject properties = new JSONObject (); TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); try { properties.put("phone_number", telephonyManager.getLine1Number()); properties.put("mobile_operator", telephonyManager.getNetworkOperatorName()); properties.put("device_model", Build.MODEL); properties.put("android_version", Build.VERSION.RELEASE); properties.put("android_version_codename", Build.VERSION.RELEASE); } catch (Exception e) { Log.e ("Get Information Error", e.getMessage()); } return properties; }
Example #2
Source File: JNIUtilities.java From Telegram-FOSS with GNU General Public License v2.0 | 7 votes |
public static String[] getCarrierInfo(){ TelephonyManager tm=(TelephonyManager) ApplicationLoader.applicationContext.getSystemService(Context.TELEPHONY_SERVICE); if(Build.VERSION.SDK_INT>=24){ tm=tm.createForSubscriptionId(SubscriptionManager.getDefaultDataSubscriptionId()); } if(!TextUtils.isEmpty(tm.getNetworkOperatorName())){ String mnc="", mcc=""; String carrierID=tm.getNetworkOperator(); if(carrierID!=null && carrierID.length()>3){ mcc=carrierID.substring(0, 3); mnc=carrierID.substring(3); } return new String[]{tm.getNetworkOperatorName(), tm.getNetworkCountryIso().toUpperCase(), mcc, mnc}; } return null; }
Example #3
Source File: LocalSongsFragment.java From ting with Apache License 2.0 | 6 votes |
@Override public void onCallStateChanged(int state, String incomingNumber) { switch (state) { case TelephonyManager.CALL_STATE_IDLE: // 挂机状态 if(phoneState){ play(currentMusic); } break; case TelephonyManager.CALL_STATE_OFFHOOK: //通话状态 case TelephonyManager.CALL_STATE_RINGING: //响铃状态 if(musicBinder.isPlaying()){ //判断歌曲是否在播放 musicBinder.stopPlay(); phoneState = true; } break; default: break; } }
Example #4
Source File: SystemFacade.java From play-apk-expansion with Apache License 2.0 | 6 votes |
public boolean isNetworkRoaming() { ConnectivityManager connectivity = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity == null) { Log.w(Constants.TAG, "couldn't get connectivity manager"); return false; } NetworkInfo info = connectivity.getActiveNetworkInfo(); boolean isMobile = (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE); TelephonyManager tm = (TelephonyManager) mContext .getSystemService(Context.TELEPHONY_SERVICE); if (null == tm) { Log.w(Constants.TAG, "couldn't get telephony manager"); return false; } boolean isRoaming = isMobile && tm.isNetworkRoaming(); if (Constants.LOGVV && isRoaming) { Log.v(Constants.TAG, "network is roaming"); } return isRoaming; }
Example #5
Source File: VolumePanel.java From Noyze with Apache License 2.0 | 6 votes |
@Override public void show() { if (!isEnabled() || (mCallState != TelephonyManager.CALL_STATE_IDLE)) return; // If we've been told to hide, we'll do it. if (null != mLastVolumeChange && mLastVolumeChange.mStreamType == STREAM_MUSIC && hideFullscreen && fullscreen) { LOGI("VolumePanel", "Not showing panel, hiding for fullscreen media."); return; } // Only show the panel if the screen is on. if (null != pWindowManager && pWindowManager.isScreenOn()) { if (null != mMediaProviderDelegate) mMediaProviderDelegate.acquire(getWindowWidth(), getWindowHeight()); super.show(); // NOTE: snapshots can be taken here, each time the panel is shown. // snapshot(); } }
Example #6
Source File: VisionEventFactoryTest.java From mapbox-events-android with MIT License | 6 votes |
private void initializeMapboxTelemetry() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); TelephonyManager mockedTelephonyManager = mock(TelephonyManager.class, RETURNS_DEEP_STUBS); when(mockedContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mockedTelephonyManager); WindowManager mockedWindowManager = mock(WindowManager.class, RETURNS_DEEP_STUBS); when(mockedContext.getSystemService(Context.WINDOW_SERVICE)).thenReturn(mockedWindowManager); AlarmManager mockedAlarmManager = mock(AlarmManager.class, RETURNS_DEEP_STUBS); when(mockedContext.getSystemService(Context.ALARM_SERVICE)).thenReturn(mockedAlarmManager); MapboxTelemetry.applicationContext = mockedContext; String aValidAccessToken = "validAccessToken"; String aValidUserAgent = "MapboxTelemetryAndroid/"; EventsQueue mockedEventsQueue = mock(EventsQueue.class); TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); Callback mockedHttpCallback = mock(Callback.class); SchedulerFlusher mockedSchedulerFlusher = mock(SchedulerFlusher.class); Clock mockedClock = mock(Clock.class); TelemetryEnabler telemetryEnabler = new TelemetryEnabler(false); new MapboxTelemetry(mockedContext, aValidAccessToken, aValidUserAgent, mockedEventsQueue, mockedTelemetryClient, mockedHttpCallback, mockedSchedulerFlusher, mockedClock, telemetryEnabler, mock(ExecutorService.class)); }
Example #7
Source File: IncommingCallReceiver.java From QuranAndroid with GNU General Public License v3.0 | 6 votes |
@Override public void onReceive(Context context, Intent intent) { try { System.out.println("Receiver start"); String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); String incomingNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); //receive_incoming_call if(state.equals(TelephonyManager.EXTRA_STATE_RINGING)){ LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent("receive_incoming_call").putExtra("state",1)); } //EXTRA_STATE_OFFHOOK if ((state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))){ LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent("EXTRA_STATE_OFFHOOK").putExtra("state",3)); } //rejected_incoming_call if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)){ LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent("rejected_incoming_call").putExtra("state",2)); } } catch (Exception e){ e.printStackTrace(); } }
Example #8
Source File: DeviceUtils.java From fangzhuishushenqi with Apache License 2.0 | 6 votes |
/** * 获取手机网络运营商类型 * * @param context * @return */ public static String getPhoneISP(Context context) { if (context == null) { return ""; } TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String teleCompany = ""; String np = manager.getNetworkOperator(); if (np != null) { if (np.equals(CMCC_ISP) || np.equals(CMCC2_ISP)) { teleCompany = "中国移动"; } else if (np.startsWith(CU_ISP)) { teleCompany = "中国联通"; } else if (np.startsWith(CT_ISP)) { teleCompany = "中国电信"; } } return teleCompany; }
Example #9
Source File: NetworkLocationProvider.java From your-local-weather with GNU General Public License v3.0 | 6 votes |
@Override public void onCreate() { super.onCreate(); mTelephonyManager = ((TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE)); alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE); wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE); try { mWifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY, "SCAN_LOCK"); if (!mWifiLock.isHeld()) { mWifiLock.acquire(); } } catch (UnsupportedOperationException uoe) { appendLog(getBaseContext(), TAG, "Unable to acquire wifi lock.", uoe); } registerReceiver(mReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); }
Example #10
Source File: SysAPIUtil.java From CacheEmulatorChecker with Apache License 2.0 | 6 votes |
public DeviceUuidFactory(Context context) { if (uuid == null) { synchronized (DeviceUuidFactory.class) { if (uuid == null) { { final String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); try { // 刷机 // 都可以被hook if (!"9774d56d682e549c".equals(androidId)) { uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8")); } else { final String deviceId = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); uuid = deviceId != null ? UUID.nameUUIDFromBytes(deviceId.getBytes("utf8")) : UUID.randomUUID(); } } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } // Write the value out to the prefs file } } } } }
Example #11
Source File: DeviceUtils.java From SprintNBA with Apache License 2.0 | 6 votes |
/** * 获取手机网络运营商类型 * * @param context * @return */ public static String getPhoneISP(Context context) { if (context == null) { return ""; } TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String teleCompany = ""; String np = manager.getNetworkOperator(); if (np != null) { if (np.equals(CMCC_ISP) || np.equals(CMCC2_ISP)) { teleCompany = "中国移动"; } else if (np.startsWith(CU_ISP)) { teleCompany = "中国联通"; } else if (np.startsWith(CT_ISP)) { teleCompany = "中国电信"; } } return teleCompany; }
Example #12
Source File: SubscriptionManager.java From GravityBox with Apache License 2.0 | 6 votes |
private List<IIconListAdapterItem> getSubItemList(final SubType subType) { List<IIconListAdapterItem> list = new ArrayList<>(); if (subType == SubType.VOICE) { list.add(new SubListItem(null)); final TelecomManager telecomManager = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE); final TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); final Iterator<PhoneAccountHandle> phoneAccounts = telecomManager.getCallCapablePhoneAccounts().listIterator(); while (phoneAccounts.hasNext()) { final PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccounts.next()); int subId = getSubIdForPhoneAccount(telephonyManager, phoneAccount); if (subId != -1) { list.add(new SubListItem(mSubMgr.getActiveSubscriptionInfo(subId))); } } } else { for (SubscriptionInfo si : mSubMgr.getActiveSubscriptionInfoList()) if (si != null) list.add(new SubListItem(si)); } return list; }
Example #13
Source File: CallService.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static void cancelCall(Context context) { try { TelephonyManager tm = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); Class c = Class.forName(tm.getClass().getName()); Method m = c.getDeclaredMethod("getITelephony"); m.setAccessible(true); Object telephonyService = m.invoke(tm); // Get the internal ITelephony object c = Class.forName(telephonyService.getClass().getName()); // Get its class m = c.getDeclaredMethod("endCall"); // Get the "endCall()" method m.setAccessible(true); // Make it accessible m.invoke(telephonyService); // invoke endCall() } catch (Exception ex) { ex.printStackTrace(); } }
Example #14
Source File: CustomBottomSheetDialog.java From faveo-helpdesk-android-app with Open Software License 3.0 | 6 votes |
public int getCountryZipCode() { String CountryID = ""; String CountryZipCode = ""; int code = 0; TelephonyManager manager = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); //getNetworkCountryIso CountryID = manager.getSimCountryIso().toUpperCase(); String[] rl = this.getResources().getStringArray(R.array.spinnerCountryCodes); for (int i = 0; i < rl.length; i++) { String[] g = rl[i].split(","); if (g[1].trim().equals(CountryID.trim())) { CountryZipCode = g[0]; code = i; break; } } return code; }
Example #15
Source File: SystemFacade.java From travelguide with Apache License 2.0 | 6 votes |
public boolean isNetworkRoaming() { ConnectivityManager connectivity = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity == null) { Log.w(Constants.TAG, "couldn't get connectivity manager"); return false; } NetworkInfo info = connectivity.getActiveNetworkInfo(); boolean isMobile = (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE); TelephonyManager tm = (TelephonyManager) mContext .getSystemService(Context.TELEPHONY_SERVICE); if (null == tm) { Log.w(Constants.TAG, "couldn't get telephony manager"); return false; } boolean isRoaming = isMobile && tm.isNetworkRoaming(); if (Constants.LOGVV && isRoaming) { Log.v(Constants.TAG, "network is roaming"); } return isRoaming; }
Example #16
Source File: hb.java From letv with Apache License 2.0 | 6 votes |
private void w() { TelephonyManager telephonyManager = (TelephonyManager) hn.a().c().getSystemService("phone"); if (telephonyManager != null) { String deviceId = telephonyManager.getDeviceId(); if (deviceId != null && deviceId.trim().length() > 0) { try { byte[] f = jn.f(deviceId); if (f == null || f.length != 20) { ib.a(6, a, "sha1 is not " + 20 + " bytes long: " + Arrays.toString(f)); } else { this.i = f; } } catch (Exception e) { ib.a(6, a, "Exception in generateHashedImei()"); } } } }
Example #17
Source File: CellBackendHelper.java From android_external_UnifiedNlpApi with Apache License 2.0 | 6 votes |
private static Cell.CellType getCellType(int networkType) { switch (networkType) { case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_EDGE: return Cell.CellType.GSM; case TelephonyManager.NETWORK_TYPE_UMTS: case TelephonyManager.NETWORK_TYPE_HSDPA: case TelephonyManager.NETWORK_TYPE_HSUPA: case TelephonyManager.NETWORK_TYPE_HSPA: case TelephonyManager.NETWORK_TYPE_HSPAP: return Cell.CellType.UMTS; case TelephonyManager.NETWORK_TYPE_LTE: return Cell.CellType.LTE; case TelephonyManager.NETWORK_TYPE_EVDO_0: case TelephonyManager.NETWORK_TYPE_EVDO_A: case TelephonyManager.NETWORK_TYPE_EVDO_B: case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_EHRPD: case TelephonyManager.NETWORK_TYPE_IDEN: return Cell.CellType.CDMA; } return null; }
Example #18
Source File: NetworkUtil.java From ONE-Unofficial with Apache License 2.0 | 6 votes |
/** * @param context * @param * @return * @description 判断网络是否是漫游 * @date 2014-12-5 * @author 史永飞 */ public boolean isNetworkRoaming(Context context) { if (conManager != null) { NetworkInfo info = conManager.getActiveNetworkInfo(); if (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE) { TelephonyManager tm = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); if (tm != null && tm.isNetworkRoaming()) { Log.d("Tag", "network is roaming"); return true; } else { Log.d("Tag", "network is not roaming"); } } } return false; }
Example #19
Source File: Net.java From HttpInfo with Apache License 2.0 | 6 votes |
public static boolean hasSimCard(Context context) { boolean result = true; try { TelephonyManager telMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); int simState = telMgr.getSimState(); switch (simState) { case TelephonyManager.SIM_STATE_ABSENT: result = false; break; case TelephonyManager.SIM_STATE_UNKNOWN: result = false; break; default: break; } } catch (Exception e) { //ignore } return result; }
Example #20
Source File: LDNetDiagnoService.java From AndroidHttpCapture with MIT License | 5 votes |
/** * 初始化网络诊断服务 * * @param theAppCode * @param theDeviceID * @param theUID * @param theDormain */ public LDNetDiagnoService(Context context, String theAppCode, String theAppName, String theAppVersion, String theUID, String theDeviceID, String theDormain, String theCarrierName, String theISOCountryCode, String theMobileCountryCode, String theMobileNetCode, LDNetDiagnoListener theListener) { super(); this._context = context; this._appCode = theAppCode; this._appName = theAppName; this._appVersion = theAppVersion; this._UID = theUID; this._deviceID = theDeviceID; this._dormain = theDormain; this._carrierName = theCarrierName; this._ISOCountryCode = theISOCountryCode; this._MobileCountryCode = theMobileCountryCode; this._MobileNetCode = theMobileNetCode; this._netDiagnolistener = theListener; // this._isRunning = false; _remoteIpList = new ArrayList<String>(); _telManager = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); sExecutor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE, TimeUnit.SECONDS, sWorkQueue, sThreadFactory); }
Example #21
Source File: DeviceUtil.java From SimpleProject with MIT License | 5 votes |
/** * 获取手机的IMEI码 * @param context * @return */ @SuppressLint("MissingPermission") public static String getDeviceId(Context context) { TelephonyManager phoneManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (phoneManager != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { return phoneManager.getImei(); } else { return phoneManager.getDeviceId(); } } return ""; }
Example #22
Source File: Util.java From kcanotify with GNU General Public License v3.0 | 5 votes |
public static String getNetworkGeneration(int networkType) { switch (networkType) { case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_CDMA: case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_IDEN: return "2G"; case TelephonyManager.NETWORK_TYPE_EHRPD: case TelephonyManager.NETWORK_TYPE_EVDO_0: case TelephonyManager.NETWORK_TYPE_EVDO_A: case TelephonyManager.NETWORK_TYPE_EVDO_B: case TelephonyManager.NETWORK_TYPE_HSDPA: case TelephonyManager.NETWORK_TYPE_HSPA: case TelephonyManager.NETWORK_TYPE_HSPAP: case TelephonyManager.NETWORK_TYPE_HSUPA: case TelephonyManager.NETWORK_TYPE_UMTS: case NETWORK_TYPE_TD_SCDMA: return "3G"; case TelephonyManager.NETWORK_TYPE_LTE: case NETWORK_TYPE_IWLAN: return "4G"; default: return "?G"; } }
Example #23
Source File: PlatformNetworksManager.java From 365browser with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private static VisibleCell getConnectedCellPostJellyBeanMr1( Context context, TelephonyManager telephonyManager) { if (!hasLocationPermission(context)) { return VisibleCell.UNKNOWN_MISSING_LOCATION_PERMISSION_VISIBLE_CELL; } CellInfo cellInfo = getActiveCellInfo(telephonyManager); return getVisibleCellPostJellyBeanMr1( cellInfo, sTimeProvider.getElapsedRealtime(), sTimeProvider.getCurrentTime()); }
Example #24
Source File: AndroidCellularSignalStrength.java From 365browser with Apache License 2.0 | 5 votes |
/** * Returns all observed cell information from all radios on the device including the primary * and neighboring cells. Returns only the information of cells that are registered to a * mobile network. May return {@code null}. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) private static List<CellInfo> getRegisteredCellInfo() { if (!isAPIAvailable()) { return null; } TelephonyManager telephonyManager = (TelephonyManager) ContextUtils.getApplicationContext().getSystemService( Context.TELEPHONY_SERVICE); if (telephonyManager == null) { return null; } List<CellInfo> cellInfos = telephonyManager.getAllCellInfo(); if (cellInfos == null) { return null; } Iterator<CellInfo> iter = cellInfos.iterator(); while (iter.hasNext()) { if (!iter.next().isRegistered()) { iter.remove(); } } return cellInfos; }
Example #25
Source File: DeviceUtils.java From ToolsFinal with Apache License 2.0 | 5 votes |
/** * 判断当前设备是否为手机 * @param context * @return */ public static boolean isPhone(Context context) { TelephonyManager telephony = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); if (telephony.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) { return false; } else { return true; } }
Example #26
Source File: ResourceQualifiersFragment.java From java-android-developertools with Apache License 2.0 | 5 votes |
protected String getBestGuessMobileNetworkCode(Configuration configuration) { TelephonyManager telephonyManager = (TelephonyManager) getActivity().getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { if (telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY) { String simOperator = telephonyManager.getSimOperator(); if (simOperator != null && simOperator.length() > 3) { return simOperator.substring(3); } } } Log.w(TAG, "Falling back to configuration's MNC which is missing info about any 0 prefixing. MNC is [" + configuration.mnc + "]"); return Integer.toString(configuration.mnc); // TODO: Should we warn the user that if the is number 10-99 it might have 0 prefixed and if the number is 0-9 it might have 0 or 00 prefixed? }
Example #27
Source File: PlayerService.java From BambooPlayer with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); mInitialized = false; mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); mTelephonyManager.listen(mPhoneListener, PhoneStateListener.LISTEN_CALL_STATE); mAm = (AudioManager) getSystemService(Context.AUDIO_SERVICE); int a = mAm.requestAudioFocus(focusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN); }
Example #28
Source File: TelephoneUtil.java From zone-sdk with MIT License | 5 votes |
/** * Qualcomm Phone. * 获取 高通 神机的双卡 IMSI、IMSI 信息 */ @SuppressWarnings("ALL") public static TeleInfo getQualcommTeleInfo(Context context) { TeleInfo teleInfo = new TeleInfo(); try { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); Class<?> simTMclass = Class.forName("android.telephony.MSimTelephonyManager"); Object sim = context.getSystemService("phone_msim"); int simId_1 = 0; int simId_2 = 1; Method getSubscriberId = simTMclass.getMethod("getSubscriberId", int.class); String imsi_1 = (String) getSubscriberId.invoke(sim, simId_1); String imsi_2 = (String) getSubscriberId.invoke(sim, simId_2); teleInfo.imsi_1 = imsi_1; teleInfo.imsi_2 = imsi_2; Method getDeviceId = simTMclass.getMethod("getDeviceId", int.class); String imei_1 = (String) getDeviceId.invoke(sim, simId_1); String imei_2 = (String) getDeviceId.invoke(sim, simId_2); teleInfo.imei_1 = imei_1; teleInfo.imei_2 = imei_2; Method getDataState = simTMclass.getMethod("getDataState"); int phoneType_1 = tm.getDataState(); int phoneType_2 = (Integer) getDataState.invoke(sim); teleInfo.phoneType_1 = phoneType_1; teleInfo.phoneType_2 = phoneType_2; } catch (Exception e) { e.printStackTrace(); } LogZSDK.INSTANCE.i("Qualcomm: " + teleInfo); return teleInfo; }
Example #29
Source File: DeviceApi18.java From AIMSICDL with GNU General Public License v3.0 | 5 votes |
public static void startListening(TelephonyManager tm, PhoneStateListener listener) { tm.listen(listener, PhoneStateListener.LISTEN_CELL_INFO | PhoneStateListener.LISTEN_CELL_LOCATION | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE | PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS ); }
Example #30
Source File: PatchUtils.java From tinker-manager with Apache License 2.0 | 5 votes |
public static String getDeviceId(Context context) { String deviceId; try { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); deviceId = telephonyManager.getDeviceId(); } catch (SecurityException e) { deviceId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); } return TextUtils.isEmpty(deviceId) ? "" : deviceId; }