Sending Multipart SMS

Put your problem here if it does not fit any of the other categories.

Sending Multipart SMS

Postby shchethan » Tue Jan 27, 2009 5:25 pm

Hi,

I am trying to send a multipart SMS using the following code. While the SMS is being split into multiple parts and sent across, in the receiver, I am seeing some junk characters. Obviously, I am not doing something correct. Can someone (plusminus :) ) help?

package com.test;

import java.util.ArrayList;

import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.gsm.SmsManager;
import android.util.Log;

public class SMSSender extends Activity {



@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
SmsManager smsManager = SmsManager.getDefault();
String destAddr = "5556", scAddr = null, mMessageText =
"This is a sample SMS which has more than 160 characters if it has more characters, it will give an error as the standard SMS can contain only 160 characters. sjkdfkajshgf kajsh fkajdgh";
PendingIntent sentIntent = null, deliveryIntent = null;
try {
ArrayList<PendingIntent> listOfIntents = new ArrayList<PendingIntent>(0);
//PendingIntent il = PendingIntent.getBroadcast(this, 0, new Intent(), 0);
ArrayList<String> messages = smsManager.divideMessage(mMessageText);

Log.v("****************", messages.toString());

for (int i=0; i < messages.size(); i++){

PendingIntent pi = PendingIntent.getBroadcast(this, 0, new Intent(), 0);
listOfIntents.add(pi);
}
smsManager.sendMultipartTextMessage(destAddr, null, messages, listOfIntents, null);

} catch (Exception e) {
Log.i("TEST", e.toString());
}
}
}

Thanks in advance

Chethan
shchethan
Freshman
Freshman
 
Posts: 3
Joined: Mon Jan 12, 2009 4:42 pm

Top

Postby MrSnowflake » Tue Jan 27, 2009 5:34 pm

Aren't those junk characters part of the multipart sms header-glue stuff?
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby shchethan » Wed Jan 28, 2009 5:27 am

I see some ASCII symbols (as if i am reading a binary file). Not the alphabets...
I am not sure if they are a part of the Header glue - but I don't see my original SMS text .... only these strange characters. :oops:
Am i doing something wrong that I am seeing the header and not the actual text.
Howver the same code works fine for < 160 characters !!

Please help !!

Thanks,
Chethan
shchethan
Freshman
Freshman
 
Posts: 3
Joined: Mon Jan 12, 2009 4:42 pm

Postby MrSnowflake » Thu Jan 29, 2009 10:47 am

I have no idea how this stuff works, so I only could try a sugestion :). But I can't help you anymore. I hope someone here can help you.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Re: Sending Multipart SMS

Postby Gf11speed » Thu Jul 08, 2010 1:02 am

Anybody have a solution to this problem? This seems to be the same issue (pic included):

post36787.html?hilit=sendMultipartTextMessage#p36787
Gf11speed
Freshman
Freshman
 
Posts: 2
Joined: Thu Jul 08, 2010 12:54 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot], MSNbot Media, Yahoo [Bot] and 13 guests