Send DataSMS exceeding the SMS size limit. Android - java

I am trying to send an SMS from an android device (sender) to an J2ME device (receiver).
I have to send the information through a specific port, so Android offers me the sendDataMessage method which sends the information as bytes and allows to add an specific port.
All works fine for SMS smaller than the limit size.
But if I use this method for SMS with information that exceeds the limit size (133bytes per SMS, I think) the following error appears:
Take a look just in the MediatekClassFactory and MaliEGL labels.
I use this code to configure and send the SMS:
SmsManager smsManager = SmsManager.getDefault();
String Numero_SMS=configuracao.getNumeroSMS();
short Porto_SMS=Short.parseShort(configuracao.getPortoSMS());
smsManager.sendDataMessage(Numero_SMS, null, Porto_SMS, mensaje.getBytes(), null,null);
So, I can not use the sendMultipartTextMessage method because that doesn't allow me to especify a port number.
Any idea for sending longer SMS especifying the port number?
Thank you,

Related

Send a spoofed sms on android using sim card

I recently made an app which could send messages using the android smsManager api, and was wondering if there is a way to send a sms message through the an android api where the id of the sender is spoofed.
this is the current state of the code I used which sends the message to my cell:
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(recipient, scAdress, msg, null, null);
I've tried to edit the scAddress, but the message doesnt send (I was seeing if that would work, and wasn't sure what scAdress was)
I am also aware that I could use a site like Twilio or Tropo, but I want to send the message through the sim card, not over the internet.
I know you are interested in doing this on your current SIM via other means. Sorry I can't be of more help there. However, this does sound like a fun way to play with Twilio Wireless. You should check out the documentation here.

How to send a sms in Android without it going into the sent box?

I am currently using
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
to send sms messages from an android phone. However it always goes immediately into the phone's sent box ("content://sms/sent") is there away to send sms messsages without it going into the sent box?
P.S. I know how to delete messages from the sent box but that requires waiting for about a second before it is stored in the box.

Is it possible to send a message from one app to another?

I have a text messaging app that I want users to be able to text another app of mine on someone else's phone that will show up within the app. Printed on screen. I have one app that will send the message and one app on the receiving device that will display the message. How would I go about doing this?
The receiving app is an opengl app that will display the message in front of a 3d model from the sending app.
If someone could help me out or get me going in the right direction, I would greatly appreciate it. Thank you for your time.
EDIT: This is what I'm doing. I'm making a live wallpaper that women can put on their phone, a seperate "regular" app will allow the husband, fiance, etc to send a message to the lwp on the significant others phone that will display at the top half of the lwp screen.
public void sendSMS(String phoneNumber, String message)
{
PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,
new Intent(SENT), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,
new Intent(DELIVERED), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);
}
You can do something like this for sending the sms.
Yes, it's possible.
Use SMSPopup as a working Android project you can use. It has the two parts you need: the sending part and the receiving part, and it's open source. Here it is on Google Play.
The only issue is that the user probably won't want those application messages intermingled with his normal SMS messages.
So you'll want to tag your application text messages with a unique keyword so that the receiving app knows it's a message for itself and no one else. And by tagging, I just mean to insert a unique keyword at the beginning of its subject line.
And your receiving app will have to register a BroadcastReceiver with a priority of 100 so that if it detects a message intended for itself, it can just delete it from the content provider and just do an AbortBroadcast so that the other text messaging apps don't beep for a message that wasn't meant for them in the first place.
In that sense, SMSPopup probably already does 90% of what you need. SMSPopup doesn't automatically delete the sms it receives, nor will it filter them on a particular keyword, but it must silently swallow them so that the normal notification system for sms doesn't get triggered (since SMSPopup provides its own notification popup interface instead).
Hi Steve we have RabbitMQServer to send messages between apps. We should configure the server and need to implement functionlities to send and receiving messages.
You may get details about RabbitMQ server at http://www.rabbitmq.com/.

android AppWidget: SMS query works on emulator, but not on a real device

I have built an appWidget which update it's unread sms count for specific contact when a new sms comes in, for that I've registered a contentObserver to monitor incoming sms.
The mySMSObserver class calls the method below for getting the number of unread messages for specific contact, by his ID.
So far so good, the problem is that the query below works fine on the emulator, but when I try that on my android device it allways return 0 unread messages (as shown by Toast).
private static String updateUnreadSMS(String contactID, Context context) {
ContentResolver cr=context.getContentResolver();
//final Uri SMS_INBOX=(Uri.parse("content://mms-sms/conversations"));
//final Uri SMS_INBOX=(Uri.parse("content://mms/inbox"));
final Uri SMS_INBOX=Uri.parse("content://sms/inbox");
Cursor c = cr.query(SMS_INBOX, null, "read = 0 AND person=?", new String[]{contactID}, null);
// get number of unread sms messages
int unreadMessagesCount = c.getCount();
Log.d("DEBUG", "UnreadSMS: "+unreadMessagesCount);
Toast.makeText(context, "updateUnreadSMS "+unreadMessagesCount, Toast.LENGTH_LONG).show();
c.deactivate();
return String.valueOf(unreadMessagesCount);
}
Is there different query's needed for different devices?
how do I write the same query for "content://mms/inbox"?, Because "person=?" is an illegal field for that query.
Will be glad for your help and advice for solving this problem :)
Accessing the databases directly might not be the best idea. As locations and data structure might change with different Android versions (It did so with the Calendar storage from 7 => 8). Nevertheless check if your device location and database structure is the same.
For MMS you might take a peek at PduParser used to parse MMS messages and other classes in this folder.

Sending messages from pc via mobile phone using java

I am working on an application, using java, that has the following features:
User connects his mobile to a PC using a usb cable or bluetooth.
User types a message on his PC (in the textfield provided by my software).
User types a phone number (in a textbox provided by my software).
User clicks the send button.
Then, the software should send the message to the specified phone number and appropriate charges should be applied to my mobile balance. In other words, I am directing my mobile through my software to send message to a specified number.
How shall i do that? Is core java sufficient for this purpose or i have to use j2me or is there any particular java framework that would be suitable for this?
One option is to connect the phone to the pc using serial link (COM). Need to configure the phone connected physically by USB or Bluetooth in order to appear in a COM (serial) port.
Then you need to create an application for PC (Java or whatever can open serial ports) that opens the COM port used by the phone and send the proper AT commands. Serial port can be opened by JavaComm 2.0 Win32 or more recently RxTx.
Open the serial port and write and read command by writing and reading bytes, in the same way a socket.
Then create a visual application that let user set the information like phone number for destination, text...
You need Java SE or whatever language allows you to create visual applications and opening serial ports (Java, .NET, Python...).
Some links about AT commands by serial port in Windows: 1, 2, 3.
Another option could be using native API from the mobile OS through a socket, but seems complex and using AT commands and serial port should work for all phones and the only problem is connecting the phone by serial over USB or BlueTooth and managing the serial port.
This is highly dependent on the Mobile OS you're using. Are you using Windows Mobile, Android OS, BlackBerry OS?
If you're using Android, then you should use the built in SmsManager to do that. The SmsManager can do the following:
Manages SMS operations such as sending data, text, and pdu SMS messages.
Update:
Since you're using Symbian OS, then check out the documentation for more information on sending SMS messages. I assume that you can figure out the rest (i.e. how to get the text fields for the number and the message, etc.)
Here is an example from the Symbian OS documentation:
public boolean sendSms(String number, String message){
boolean result = true;
try {
//sets address to send message
String addr = "sms://"+number;
// opens connection
MessageConnection conn = (MessageConnection) Connector.open(addr);
// prepares text message
TextMessage msg =
(TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
//set text
msg.setPayloadText(message);
// send message
conn.send(msg);
conn.close();
} catch (SecurityException se) {
// probably the user has not allowed to send sms
// you may want to handle this differently
result = false;
} catch (Exception e) {
result = false;
}
return result;
}
The above snippet came from the guide on "How to Send Text SMS in Java ME"

Categories

Resources