3

I am working on an android app to analyze a users message history.

One major issue is that i need a bank of messages to work with, ideally over a long period of time.

I have found how to send messages to the emulator via telnet but this is A. slow and B. messages are time stamped on arrival.

I would like suggestions on how to programmatically generate a pseudo-random inbox of say, 300 messages (content doesn't matter at this point, but i need a range of times and dates).

Update: As an idea, would it be possible to somehow load my phones (1.5 android) message history to the emulator?

TrewTzu
  • 1,110
  • 2
  • 11
  • 27

3 Answers3

2

If you want to track and analyse the message history in your app, you can easily use a content provider for accessing SMS messages. But it's not documented in the public SDK.

If you use ContentResolver.query() with a Uri of content://sms you should be able to access these messages on 1.5(ECLAIR) and later version.

Please go through the link for details how to do all that:Referal for Content Provider

Also before beginning on Content Provider, please visit and understand the Android Developer Blog. Once: Android Developer Blog Warns to do that..

Hartok
  • 2,147
  • 20
  • 37
Arpit Garg
  • 8,476
  • 6
  • 34
  • 59
1

Install Android Market on your emulator (see here: http://www.howtogeek.com/howto/21862/how-to-enable-the-android-market-in-the-google-android-emulator/)

Install an SMS backup app such as SMS Backup And Restore on both your real device and emulator, use it to back up messages from your real device to a file, transfer the file to desktop (email, bluetooth or whatever), put it on your emulator's virtual SD card (see: Manually put files to Android emulator SD card), use the same app to restore your messages on the emulator.

Also, to manually put stuff into the db (/data/data/com.android.providers.telephony/databases/mmssms.db), try using this tool: http://sourceforge.net/projects/sqlitebrowser/ or just write a script using sqlite3 to stuff teh db with fake data, here's another relevant thread on accessing the db: https://android.stackexchange.com/questions/11619/android-read-recent-sms-messages-from-command-line

Community
  • 1
  • 1
Ivan Bartsov
  • 19,664
  • 7
  • 61
  • 59
1

the sms db is stored at /data/data/com.android.providers.telephony/databases/mmssms.db . Copy this from your phone onto the sdk. Or you could populate the db once and take a backup and restore it everytime.

nandeesh
  • 24,740
  • 6
  • 69
  • 79