Lansung saja listingnya dishare bagi agan-agan yang lagi sibuk membuat aplikasi Send MMS Android.
private void sendMMSUsingNokiaAPI()
{
// Magic happens here.
MMMessage mm = new MMMessage();
SetMessage(mm);
AddContents(mm);
MMEncoder encoder=new MMEncoder();
encoder.setMessage(mm);
try {
encoder.encodeMessage();
byte[] out = encoder.getMessage();
MMSender sender = new MMSender();
APNHelper apnHelper = new APNHelper(this);
List<APN> results = apnHelper.getMMSApns();
if(results.size() > 0){
final String MMSCenterUrl = results.get(0).MMSCenterUrl;
final String MMSProxy = results.get(0).MMSProxy;
final int MMSPort = Integer.valueOf(results.get(0).MMSPort);
final Boolean isProxySet = (MMSProxy != null) && (MMSProxy.trim().length() != 0);
sender.setMMSCURL(MMSCenterUrl);
sender.addHeader("X-NOKIA-MMSC-Charging", "100");
MMResponse mmResponse = sender.send(out, isProxySet, MMSProxy, MMSPort);
Log.d(TAG, "Message sent to " + sender.getMMSCURL());
Log.d(TAG, "Response code: " + mmResponse.getResponseCode() + " " + mmResponse.getResponseMessage());
Enumeration keys = mmResponse.getHeadersList();
while (keys.hasMoreElements()){
String key = (String) keys.nextElement();
String value = (String) mmResponse.getHeaderValue(key);
Log.d(TAG, (key + ": " + value));
}
if(mmResponse.getResponseCode() == 200)
{
// 200 Successful, disconnect and reset.
endMmsConnectivity();
mSending = false;
mListening = false;
}
else
{
// kill dew :D hhaha
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
Jika sempat, berkunjunglah di www.kasmacell.tk
private void sendMMSUsingNokiaAPI()
{
// Magic happens here.
MMMessage mm = new MMMessage();
SetMessage(mm);
AddContents(mm);
MMEncoder encoder=new MMEncoder();
encoder.setMessage(mm);
try {
encoder.encodeMessage();
byte[] out = encoder.getMessage();
MMSender sender = new MMSender();
APNHelper apnHelper = new APNHelper(this);
List<APN> results = apnHelper.getMMSApns();
if(results.size() > 0){
final String MMSCenterUrl = results.get(0).MMSCenterUrl;
final String MMSProxy = results.get(0).MMSProxy;
final int MMSPort = Integer.valueOf(results.get(0).MMSPort);
final Boolean isProxySet = (MMSProxy != null) && (MMSProxy.trim().length() != 0);
sender.setMMSCURL(MMSCenterUrl);
sender.addHeader("X-NOKIA-MMSC-Charging", "100");
MMResponse mmResponse = sender.send(out, isProxySet, MMSProxy, MMSPort);
Log.d(TAG, "Message sent to " + sender.getMMSCURL());
Log.d(TAG, "Response code: " + mmResponse.getResponseCode() + " " + mmResponse.getResponseMessage());
Enumeration keys = mmResponse.getHeadersList();
while (keys.hasMoreElements()){
String key = (String) keys.nextElement();
String value = (String) mmResponse.getHeaderValue(key);
Log.d(TAG, (key + ": " + value));
}
if(mmResponse.getResponseCode() == 200)
{
// 200 Successful, disconnect and reset.
endMmsConnectivity();
mSending = false;
mListening = false;
}
else
{
// kill dew :D hhaha
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
Jika sempat, berkunjunglah di www.kasmacell.tk