Here is the final xml: XML
Here is a download for the library: Droidprism.jar
Javadoc: Carrier.html APN.html
Usage:
First add Jsoup to the build path.
import com.droidprism.*; Carrier c = Carrier.getCarrier("US","Verizon"); if(c != null) { String smsemail = c.getsmsemail(); String mmsemail = c.getmmsemail(); System.out.println(smsemail + " " + mmsemail); //prints vtext.com vzwpix.com com.droidprism.APN apn = c.getAPN(); if(apn != null) { String mmsc = apn.mmsc; String mmsproxy = apn.proxy; //"" if none String mmsport = apn.port; //0 if none System.out.println(mmsc +" " + mmsproxy + " " + mmsport); //prints http://mms.vtext.com/servlets/mms 0 } }
You can also get the carrier from android with mcc and mnc codes:
TelephonyManager tel = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String networkOperator = tel.getNetworkOperator(); if (networkOperator != null) { int mcc = Integer.parseInt( networkOperator.substring(0, 3)); String s = networkOperator.substring(3); //remove leading zeroes int mnc = Integer.parseInt( s.replaceFirst("^0{1,2}","")); Carrier c = Carrier.getCarrier(mcc, mnc); c.getsmsemail(); APN a = c.getAPN(); }
I added the .jar file to my project but am getting this error at the line that instantiates the Carrier object :
ReplyDeletejava.lang.NoClassDefFoundError: com.droidprism.Carrier
add Jsoup to the build path, import com.droidprism.*; If this is in android, first import the jars to the libs directory, then configure build path -> add jars -> select the jars from the libs directory, then configure build path ->order and export -> check off the jars, and click up so that jsoup and droidprism are at the top
ReplyDeleteCarrier.getCarrier(mcc, mnc);
ReplyDeleteis extremely slow (30 seconds or so) - Verizon Galaxy Nexus.
Is this an issue for anyone else?
yes i am experiencing the same response time or even longer than 30 seconds for the getCarrier call on a Nexus 5.
ReplyDeletehttps://github.com/lsteiner55/droidprism this is the repo.the code is there.
ReplyDeleteWhere is the Carrier class defined? If possible, can you include the Carrier class's definition on this page?
ReplyDelete