- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Connection c =
DataSource dataSource;dataSource.getConnection()
String url;DriverManager.getConnection(url)
IdentityDatabaseUtil.getDBConnection()
- Smart code suggestions by Codota
}
TelephonyManager tMgr = (TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE); String mPhoneNumber = tMgr.getLine1Number();
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); telephonyManager.getDeviceId();
/** * Notifies {@link OnSubscriptionsChangedListener} listeners that the list of {@link * SubscriptionInfo} has been updated. */ private void dispatchOnSubscriptionsChanged() { for (OnSubscriptionsChangedListener listener : listeners) { listener.onSubscriptionsChanged(); } }
TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); String carrierName = manager.getNetworkOperatorName();
@Test public void testListenInit() { PhoneStateListener listener = mock(PhoneStateListener.class); telephonyManager.listen(listener, LISTEN_CALL_STATE | LISTEN_CELL_INFO | LISTEN_CELL_LOCATION); verify(listener).onCallStateChanged(CALL_STATE_IDLE, null); verify(listener).onCellLocationChanged(null); if (VERSION.SDK_INT >= JELLY_BEAN_MR1) { verify(listener).onCellInfoChanged(Collections.emptyList()); } }
TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); if(mgr != null) { mgr.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); }
TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); if(manager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE){ return "Tablet"; }else{ return "Mobile"; }
private boolean isTelephonyEnabled(){ TelephonyManager telephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); return telephonyManager != null && telephonyManager.getSimState()==TelephonyManager.SIM_STATE_READY; }
private void initListener(PhoneStateListener listener, int flags) { if ((flags & LISTEN_CALL_STATE) != 0) { listener.onCallStateChanged(callState, incomingPhoneNumber); } if ((flags & LISTEN_CELL_INFO) != 0) { if (VERSION.SDK_INT >= JELLY_BEAN_MR1) { listener.onCellInfoChanged(allCellInfo); } } if ((flags & LISTEN_CELL_LOCATION) != 0) { listener.onCellLocationChanged(cellLocation); } }
public void setCellLocation(CellLocation cellLocation) { this.cellLocation = cellLocation; for (PhoneStateListener listener : getListenersForFlags(LISTEN_CELL_LOCATION)) { listener.onCellLocationChanged(cellLocation); } }
/** Sets the value to be returned by {@link #getSignalStrength()} */ public void setSignalStrength(SignalStrength signalStrength) { this.signalStrength = signalStrength; for (PhoneStateListener listener : getListenersForFlags(PhoneStateListener.LISTEN_SIGNAL_STRENGTHS)) { listener.onSignalStrengthsChanged(signalStrength); } }
public void setAllCellInfo(List<CellInfo> allCellInfo) { this.allCellInfo = allCellInfo; if (VERSION.SDK_INT >= JELLY_BEAN_MR1) { for (PhoneStateListener listener : getListenersForFlags(LISTEN_CELL_INFO)) { listener.onCellInfoChanged(allCellInfo); } } }
TelephonyManager tManager = (TelephonyManager)myActivity.getSystemService(Context.TELEPHONY_SERVICE); String uid = tManager.getDeviceId();
/** * 获取移动网络运营商名称 * <p>如中国联通、中国移动、中国电信</p> * * @param context 上下文 * @return 移动网络运营商名称 */ public static String getNetworkOperatorName(Context context) { TelephonyManager tm = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); return tm != null ? tm.getNetworkOperatorName() : null; }
public class MyClass { private WebView mAppView; private DroidGap mGap; public MyClass(DroidGap gap, WebView view) { mAppView = view; mGap = gap; } public String getTelephoneNumber(){ TelephonyManager tm = (TelephonyManager) mGap.getSystemService(Context.TELEPHONY_SERVICE); String number = tm.getLine1Number(); return number; } }
private void stopTelephonyListener() { if (mTelephonyManager != null && mPhoneStateListener != null) { mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); mTelephonyManager = null; mPhoneStateListener = null; } } }
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); telephonyManager.getDeviceId();
TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); String number = tm.getLine1Number();
EndCallListener callListener = new EndCallListener(); TelephonyManager mTM = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE); mTM.listen(callListener, PhoneStateListener.LISTEN_CALL_STATE);
public String getUniqueID(){ String myAndroidDeviceId = ""; TelephonyManager mTelephony = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (mTelephony.getDeviceId() != null){ myAndroidDeviceId = mTelephony.getDeviceId(); }else{ myAndroidDeviceId = Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID); } return myAndroidDeviceId; }