How to send and receive SMS messages from outside the emulator?

by David » Thu, 17 Apr 2008 04:22:53 GMT


Sponsored Links
 Hi, I am developing an application that requires data to be passed
between two phones via SMS messages.  One phone is a physical phone
that is our server while the other is the android emulator.  To test
the architecture I need to be able to get my messages in and out of
the emulator, so that the emulator can communicate with the server
phone.

To send messages to the emulator, I have tried opening a connection to
the emulator and sending the command "sms send <number> <message>";
however it appears that the emulator may be converting the message
into 7 bit encoding instead of leaving it at 8 bit.  This causes a
problem because my string is not meant to be interpreted as 7 bit
since the message is just a string representation of encoded and
compressed data.

At this point, our idea is to write the message to a file, push it
into the emulator, and code our SMS receiver to read the file and pass
the data in the file instead of the actual SMS message.  Then to
"send" an SMS message out, we would write it to a file and pull it out
of the emulator.  This should work but is not desirable.

Does anyone have any better suggestions on how to pass SMS data
messages in and out of the emulator?

Thanks,
David


--~--~---------~--~----~------------~-------~--~----~



How to send and receive SMS messages from outside the emulator?

by Digit » Thu, 17 Apr 2008 04:33:06 GMT


 can you elaborate about the "it appears that the emulator may be converting
the message into 7 bit encoding" ?

when using 'sms send <number> <message>', the content of <message> must be
utf-8, with a few escape conventions added in (type 'help sms send' for more
details)

internally, the SMS spec allows you to send messages in either the 7-bit GSM
alphabet or UCS-2 and the emulator will choose the proper encoding based on
the content of <message>. it will also do all the gritty-nitty segmentation
for you (since each SMS PDU is quite limited in size)

there is a known bug where any characters in the "escaped section" of the
GSM alphabet (i.e. anything in [|]{}~^) will not generate a totally proper
message, but this will be addressed in a later release...





--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. how to start application in last viewed activity in previous session

I'm writing an application consisting of several activities and, on
restarts, I'd like the application to initially display the
application's activity that was the last to display in the
application's previous session.

I save information about the last activity in SharedPreferences and
I'm trying to start that last activity with a call to
startActivity(intent) from my Application's onCreate handler.  The
problem is that if I don't set the intent's FLAG_ACTIVITY_NEW_TASK,
the result is a run-time exception message in logcat suggesting that I
should set the flag.  And if I set that intent flag, the correct
activity gets started but doesn't fully initialize resulting in null
pointer exceptions (which don't occur when I don't attempt to start
the activity from my Application class).

- - -

W/dalvikvm(  805): threadid=3: thread exiting with uncaught exception
(group=0x4000fe70)
E/AndroidRuntime(  805): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(  805): java.lang.RuntimeException: Unable to create
application com.test.tangled.TApplication:
android.util.AndroidRuntimeException: Calling startActivity() from
outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK
flag. Is this really what you want?

- - -

Any tips on how to correctly start a particular activity from the
Application class's onCreate handler?

Thanks,
Greg

-- 

2. | WTB | htc hero / qliq......

maaf repost....


lg pengen ganti nih hp
pgn coba hero atau motorola qliq atau mngkin motondroid

barangkali ada yg punya jual baik 2nd maupun baru garansi resmi...mohon di
tawarkan ya all....

lokasi di surabaya dan prefer sby...

monggo segera japri ya all...thx

-- 
"Indonesian Android Community [id-android]" 

3. When someone posts your paid app on a forum

4. Help/OOT:Ada apa dengan GMail?

5. Seeding program phones. Anyone tried to activate their droid on a private account yet?

6. NJ Court finds Owner-Operator to be Employee for Worker's Compensation Purposes

7. User Cancel - ProgressDialog