Determine whether the network is 2G or 3G

Source: Internet
Author: User
 determine whether the network is 2G or 3G 
Public static Boolean isconnectionfast (INT type, int subtype) {If (type = connectivitymanager. type_wifi) {system. out. println ("connected via wifi"); Return true;} else if (type = connectivitymanager. type_mobile) {Switch (subtype) {Case telephonymanager. network_type_1xrtt: Return false ;//~ 50-100 kbps case telephonymanager. network_type_cdma: Return false ;//~ 14-64 Kbps case telephonymanager. network_type_edge: Return false ;//~ 50-100 kbps case telephonymanager. network_type_evdo_0: Return true ;//~ 400-1000 kbps case telephonymanager. network_type_evdo_a: Return true ;//~ 600-1400 kbps case telephonymanager. network_type_gprs: Return false ;//~ 100 kbps // case telephonymanager. network_type_hsdpa: // return true ;//~ 2-14 Mbps // case telephonymanager. network_type_hspa: // return true ;//~ 700-1700 kbps // case telephonymanager. network_type_hsupa: // return true ;//~ 1-23 Mbps case telephonymanager. network_type_umts: Return true ;//~ 400-7000 kbps // not available yet in API level 7 case connectivity. network_type_ehrpd: Return true ;//~ 1-2 Mbps case connectivity. network_type_evdo_ B: Return true ;//~ 5 Mbps case connectivity. network_type_hspap: Return true ;//~ 10-20 Mbps case connectivity. network_type_iden: Return false ;//~ 25 kbps case connectivity. network_type_lte: Return true ;//~ 10 + Mbps // unknown case telephonymanager. network_type_unknown: Return false; default: Return false ;}} else {return false ;}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.