Codota Logo
android.telephony
Code IndexAdd Codota to your IDE (free)

How to use android.telephony

Best Java code snippets using android.telephony (Showing top 20 results out of 2,178)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: stackoverflow.com

 TelephonyManager tMgr = (TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
String mPhoneNumber = tMgr.getLine1Number();
origin: stackoverflow.com

 TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.getDeviceId();
origin: robolectric/robolectric

/**
 * Notifies {@link OnSubscriptionsChangedListener} listeners that the list of {@link
 * SubscriptionInfo} has been updated.
 */
private void dispatchOnSubscriptionsChanged() {
 for (OnSubscriptionsChangedListener listener : listeners) {
  listener.onSubscriptionsChanged();
 }
}
origin: stackoverflow.com

 TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
String carrierName = manager.getNetworkOperatorName();
origin: robolectric/robolectric

@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());
 }
}
origin: stackoverflow.com

 TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
if(mgr != null) {
  mgr.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
}
origin: stackoverflow.com

TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
   if(manager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE){
     return "Tablet";
   }else{
     return "Mobile";
   }
origin: stackoverflow.com

 private boolean isTelephonyEnabled(){
  TelephonyManager telephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
  return telephonyManager != null && telephonyManager.getSimState()==TelephonyManager.SIM_STATE_READY;
}
origin: robolectric/robolectric

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);
 }
}
origin: robolectric/robolectric

public void setCellLocation(CellLocation cellLocation) {
 this.cellLocation = cellLocation;
 for (PhoneStateListener listener : getListenersForFlags(LISTEN_CELL_LOCATION)) {
  listener.onCellLocationChanged(cellLocation);
 }
}
origin: robolectric/robolectric

/** 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);
 }
}
origin: robolectric/robolectric

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);
  }
 }
}
origin: stackoverflow.com

 TelephonyManager tManager = (TelephonyManager)myActivity.getSystemService(Context.TELEPHONY_SERVICE);
String uid = tManager.getDeviceId();
origin: CarGuo/GSYVideoPlayer

/**
 * 获取移动网络运营商名称
 * <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;
}
origin: stackoverflow.com

 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;
 }
}
origin: pili-engineering/PLDroidPlayer

  private void stopTelephonyListener() {
    if (mTelephonyManager != null && mPhoneStateListener != null) {
      mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
      mTelephonyManager = null;
      mPhoneStateListener = null;
    }
  }
}
origin: stackoverflow.com

TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.getDeviceId();
origin: stackoverflow.com

 TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); 
String number = tm.getLine1Number();
origin: stackoverflow.com

 EndCallListener callListener = new EndCallListener();
TelephonyManager mTM = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
mTM.listen(callListener, PhoneStateListener.LISTEN_CALL_STATE);
origin: stackoverflow.com

 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;
}
android.telephony

Most used classes

  • TelephonyManager
    Stub class for compilation purpose. Created by Oasis on 2017/7/21.
  • SmsManager
  • SmsMessage
  • GsmCellLocation
  • PhoneStateListener
  • NeighboringCellInfo,
  • CdmaCellLocation,
  • CellIdentityGsm,
  • CellIdentityLte,
  • CellIdentityWcdma,
  • CellInfoGsm,
  • CellInfoLte,
  • CellInfoWcdma,
  • ServiceState,
  • CellIdentityCdma,
  • CellInfo,
  • CellInfoCdma,
  • CellSignalStrengthLte,
  • SignalStrength
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now