android源代码
PduComposer.java /**
* Constructor.
*
* @param context the context
* @param pdu the pdu to be composed
*/
public PduComposer(Context context, GenericPdu pdu) {
mPdu = pdu;
mResolver = context.getContentResolver();
mPduHeader = pdu.getPduHeaders();
mStack = new BufferStack();
mMessage = new ByteArrayOutputStream();
mPosition = 0;
}
HttpUtils.java
/**
* A helper method to send or retrieve data through HTTP protocol.
*
* @param token The token to identify the sending progress.
* @param url The URL used in a GET request. Null when the method is
* HTTP_POST_METHOD.
* @param pdu The data to be POST. Null when the method is HTTP_GET_METHOD.
* @param method HTTP_POST_METHOD or HTTP_GET_METHOD.
* @return A byte array which contains the response data.
* If an HTTP error code is returned, an IOException will be thrown.
* @throws IOException if any error occurred on network interface or
* an HTTP error code(>=400) returned from the server.
*/
public static byte[] httpConnection(Context context, long token,
String url, byte[] pdu, int method, boolean isProxySet,
String proxyHost, int proxyPort) //以上的Context参数如何设置
Context ctx = null;
try {
ctx = createPackageContext("com.sms.message", 0);
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} 这样创建Context是否正确呢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货