|
|
@ -54,7 +54,6 @@ public class MmsSendHelper extends MmsCommunication {
|
|
|
|
request.setEntity(entity);
|
|
|
|
request.setEntity(entity);
|
|
|
|
request.setParams(client.getParams());
|
|
|
|
request.setParams(client.getParams());
|
|
|
|
request.addHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic");
|
|
|
|
request.addHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic");
|
|
|
|
// request.addHeader("x-wap-profile", "http://www.htcmms.com.tw/Android/Common/nexusone/ua-profile.xml");
|
|
|
|
|
|
|
|
request.addHeader("x-wap-profile", "http://www.google.com/oha/rdf/ua-profile-kila.xml");
|
|
|
|
request.addHeader("x-wap-profile", "http://www.google.com/oha/rdf/ua-profile-kila.xml");
|
|
|
|
HttpResponse response = client.execute(target, request);
|
|
|
|
HttpResponse response = client.execute(target, request);
|
|
|
|
StatusLine status = response.getStatusLine();
|
|
|
|
StatusLine status = response.getStatusLine();
|
|
|
@ -72,16 +71,35 @@ public class MmsSendHelper extends MmsCommunication {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void sendNotificationReceived(Context context, byte[] mms, String apn,
|
|
|
|
|
|
|
|
boolean usingMmsRadio, boolean useProxyIfAvailable)
|
|
|
|
|
|
|
|
throws IOException
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sendBytes(context, mms, apn, usingMmsRadio, useProxyIfAvailable);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static SendConf sendMms(Context context, byte[] mms, String apn,
|
|
|
|
public static SendConf sendMms(Context context, byte[] mms, String apn,
|
|
|
|
boolean usingMmsRadio, boolean useProxyIfAvailable)
|
|
|
|
boolean usingMmsRadio, boolean useProxyIfAvailable)
|
|
|
|
throws IOException
|
|
|
|
throws IOException
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
byte[] response = sendBytes(context, mms, apn, usingMmsRadio, useProxyIfAvailable);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (response == null) {
|
|
|
|
|
|
|
|
throw new IOException("Got null response!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (SendConf) new PduParser(response).parse();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static byte[] sendBytes(Context context, byte[] mms, String apn,
|
|
|
|
|
|
|
|
boolean usingMmsRadio, boolean useProxyIfAvailable)
|
|
|
|
|
|
|
|
throws IOException
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.w("MmsSender", "Sending MMS of length: " + mms.length);
|
|
|
|
Log.w("MmsSender", "Sending MMS of length: " + mms.length);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
MmsConnectionParameters parameters = getMmsConnectionParameters(context, apn, useProxyIfAvailable);
|
|
|
|
MmsConnectionParameters parameters = getMmsConnectionParameters(context, apn, useProxyIfAvailable);
|
|
|
|
checkRouteToHost(context, parameters, parameters.getMmsc(), usingMmsRadio);
|
|
|
|
checkRouteToHost(context, parameters, parameters.getMmsc(), usingMmsRadio);
|
|
|
|
byte[] response = makePost(context, parameters, mms);
|
|
|
|
return makePost(context, parameters, mms);
|
|
|
|
return (SendConf) new PduParser(response).parse();
|
|
|
|
|
|
|
|
} catch (ApnUnavailableException aue) {
|
|
|
|
} catch (ApnUnavailableException aue) {
|
|
|
|
Log.w("MmsSender", aue);
|
|
|
|
Log.w("MmsSender", aue);
|
|
|
|
throw new IOException("Failed to get MMSC information...");
|
|
|
|
throw new IOException("Failed to get MMSC information...");
|
|
|
|