找到Android的GPRS状态 [英] Find Android GPRS status

查看:110
本文介绍了找到Android的GPRS状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的销售代表的销售application.This应用。因此,我们不能保证任何地方WiFi或3G可用。所以,我要检查的GPRS连接。 &放大器;销售代表需要做replication.If的GPRS强度高于特定的速率然后让做复制。

I have sales application.This application used by sales rep. So We can't make sure anywhere wifi or 3G available. So I have to check the GPRS connection. & Sales rep need to do the replication.If the GPRS strength is higher than particular rate then allow to do the replication.

如何找出GPRS是实现?我想打电话给webservice.First它检查WIFI,3G,GPRS话。

How to find out GPRS is enable ? I want to call webservice.First It check WIFI,3G,then GPRS.

有关WIFI,3G我不喜欢这样

For WIFI, 3G I did like this

 ConnectivityManager manager = (ConnectivityManager) getSystemService(DownlaodTableActivity.CONNECTIVITY_SERVICE);
    Boolean is3g = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnectedOrConnecting();
    Boolean isWifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting();
    if(isWifi ){ ..... } else if(is3g){ ..... } else if(GPRS) {....}

有关GPRS我做了这样的:如何获得GSM力量外界方法

For GPRS I have done like: How to get the GSM Strength outside method

请任何人告诉我怎么走GPRS连接。

Please anybody tell me how to take the GPRS connection.

(销售代表必须使用GPRS连接可用手机。)

(Sales rep must use GPRS connection available phone.)

推荐答案

我不知道如果你能做到这一切的时候,但如果用户连接数据网络上,你可以查看当前的网络类型为GPRS或不使用以下code:

I am not sure if you can do this all the time, but if user is connected on data network you can check current network type as GPRS or not using following code:

TelephonyManager mgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
int networkType = mgr.getNetworkType()

和如果是GPRS的值将是 TelephonyManager.NETWORK_TYPE_GPRS

and if it is gprs the value will be TelephonyManager.NETWORK_TYPE_GPRS

这篇关于找到Android的GPRS状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆