android.telephony.TelephonyManager.getDataState()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中android.telephony.TelephonyManager.getDataState()方法的一些代码示例,展示了TelephonyManager.getDataState()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TelephonyManager.getDataState()方法的具体详情如下:
包路径:android.telephony.TelephonyManager
类名称:TelephonyManager
方法名:getDataState

TelephonyManager.getDataState介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public TelephonyManagerAssert hasDataState(@TelephonyManagerDataState int dataState) {
 isNotNull();
 int actualDataState = actual.getDataState();
 //noinspection ResourceType
 assertThat(actualDataState) //
   .overridingErrorMessage("Expected data state <%s> but was <%s>.",
     dataStateToString(dataState), dataStateToString(actualDataState)) //
   .isEqualTo(dataState);
 return this;
}

代码示例来源:origin: klinker41/android-smsmms

public static boolean allowAutoDownload(Context context) {
  try { Looper.prepare(); } catch (Exception e) { }
  boolean autoDownload = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("auto_download_mms", true);
  boolean dataSuspended = (((TelephonyManager) context.getSystemService(Service.TELEPHONY_SERVICE)).getDataState() ==
      TelephonyManager.DATA_SUSPENDED);
  return autoDownload && !dataSuspended;
}

代码示例来源:origin: huangweicai/OkLibDemo

int phoneType_1 = tm.getDataState();
int phoneType_2 = (Integer) getDataState.invoke(sim);
teleInfo.phoneType_1 = phoneType_1;

代码示例来源:origin: Leeii/LeeFream

int phoneType_1 = tm.getDataState();
int phoneType_2 = (Integer) getDataState.invoke(sim);
teleInfo.phoneType_1 = phoneType_1;

代码示例来源:origin: luhaoaimama1/zone-sdk

int phoneType_1 = tm.getDataState();
int phoneType_2 = (Integer) getDataState.invoke(sim);
teleInfo.phoneType_1 = phoneType_1;

代码示例来源:origin: com.squareup.assertj/assertj-android

public TelephonyManagerAssert hasDataState(@TelephonyManagerDataState int dataState) {
 isNotNull();
 int actualDataState = actual.getDataState();
 //noinspection ResourceType
 assertThat(actualDataState) //
   .overridingErrorMessage("Expected data state <%s> but was <%s>.",
     dataStateToString(dataState), dataStateToString(actualDataState)) //
   .isEqualTo(dataState);
 return this;
}

代码示例来源:origin: renyuneyun/Easer

Boolean state = data.get();
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (state == (telephonyManager.getDataState() == TelephonyManager.DATA_CONNECTED)) {
  return true;
} else {

代码示例来源:origin: stackoverflow.com

if (tmanager.getDataState() == TelephonyManager.DATA_CONNECTED) {

代码示例来源:origin: stackoverflow.com

if (tmanager.getDataState() == TelephonyManager.DATA_CONNECTED) {

代码示例来源:origin: fennifith/Status

private void onDataChanged() {
  switch (telephonyManager.getDataState()) {
    case TelephonyManager.DATA_CONNECTED:
    case TelephonyManager.DATA_CONNECTING:
      if (telephonyManager.getDataState() != TelephonyManager.DATA_DISCONNECTED) {
        switch (telephonyManager.getNetworkType()) {
          case TelephonyManager.NETWORK_TYPE_GPRS:

代码示例来源:origin: denzilferreira/aware-client

rowData.put(Telephony_Data.TIMESTAMP, timestamp);
rowData.put(Telephony_Data.DEVICE_ID, device_id);
rowData.put(Telephony_Data.DATA_ENABLED, telephonyManager.getDataState());
rowData.put(Telephony_Data.IMEI_MEID_ESN, Encrypter.hash(getApplicationContext(), telephonyManager.getDeviceId()));
rowData.put(Telephony_Data.SOFTWARE_VERSION, telephonyManager.getDeviceSoftwareVersion());

代码示例来源:origin: stackoverflow.com

WifiManager lWifiManager = (WifiManager) OpenYouTubePlayerActivity.this.getSystemService(Context.WIFI_SERVICE);
TelephonyManager lTelephonyManager = (TelephonyManager) OpenYouTubePlayerActivity.this.getSystemService(Context.TELEPHONY_SERVICE);

////////////////////////////
// if we have a fast connection (wifi or 3g)
if( (lWifiManager.isWifiEnabled() && lWifiManager.getConnectionInfo() != null && lWifiManager.getConnectionInfo().getIpAddress() != 0) ||
  ( (lTelephonyManager.getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS ||

  /* icky... using literals to make backwards compatible with 1.5 and 1.6 */      
  lTelephonyManager.getNetworkType() == 9 /*HSUPA*/  ||
  lTelephonyManager.getNetworkType() == 10 /*HSPA*/  ||
  lTelephonyManager.getNetworkType() == 8 /*HSDPA*/  ||
  lTelephonyManager.getNetworkType() == 5 /*EVDO_0*/  ||
  lTelephonyManager.getNetworkType() == 6 /*EVDO A*/) 

  && lTelephonyManager.getDataState() == TelephonyManager.DATA_CONNECTED) 
  ){
    //Do some thing here
}

代码示例来源:origin: termux/termux-api

int dataState = manager.getDataState();
String dataStateString;
switch (dataState) {

相关文章