Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Read SMS
Started by awkaw Apr 02 2017 08:46 AM

7 replies to this topic
sms android
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

awkaw

[GLOBAL: userInfoPane.html]
awkaw
  • Enthusiast

  • 41 posts
  • Corona SDK

Hello! How to read SMS?



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,241 posts
  • Enterprise

Corona SDK does not provide a facility for this. I do not believe it's possible on iOS and there's a good chance it's not possible on Android without a rooted or jailbroken device.

 

If it is possible on Android without being rooted, then you potentially could use Corona Enterprise to reach the native SDK's needed.

 

Rob



[TOPIC: post.html]
#3

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 1,957 posts
  • Corona SDK

WhatsApp certainly can read SMS messages without root on Android (not sure about iOS).  I'm not sure on a valid case for reading users SMS messages as that is quite invasive.



[TOPIC: post.html]
#4

yosu

[GLOBAL: userInfoPane.html]
yosu
  • Contributor

  • 508 posts
  • Corona SDK

I've done it before on Android studio.

 

It is possible on corona enterprise, as Android already has this feature few years ago, to read SMS. You need to set the priority to the highest so your app captures the SMS first.



[TOPIC: post.html]
#5

awkaw

[GLOBAL: userInfoPane.html]
awkaw
  • Enthusiast

  • 41 posts
  • Corona SDK

[TOPIC: post.html]
#6

awkaw

[GLOBAL: userInfoPane.html]
awkaw
  • Enthusiast

  • 41 posts
  • Corona SDK

// public static final String INBOX = "content://sms/inbox";
// public static final String SENT = "content://sms/sent";
// public static final String DRAFT = "content://sms/draft";
Cursor cursor = getContentResolver().query(Uri.parse("content://sms/inbox"), null, null, null, null);

if (cursor.moveToFirst()) { // must check the result to prevent exception
    do {
       String msgData = "";
       for(int idx=0;idx<cursor.getColumnCount();idx++)
       {
           msgData += " " + cursor.getColumnName(idx) + ":" + cursor.getString(idx);
       }
       // use msgData
    } while (cursor.moveToNext());
} else {
   // empty box, no SMS
}

This is Java code for reading SMS. How can this be done on the Corona SDK Free?



[TOPIC: post.html]
#7

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,241 posts
  • Enterprise

As I stated above, we really have no way do this in Corona SDK (the free product). But you have several options that you can explore and they include.

 

1. Purchase Corona Enterprise and do it yourself.

2. Vote up the existing feature request for this.  Visit http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/4398825-be-able-to-recieve-and-send-sms-in-app-instead-of and cast more votes for it.

3. Find a plugin developer who has Corona Enterprise and see if they can build a plugin for you.

 

Rob



[TOPIC: post.html]
#8

awkaw

[GLOBAL: userInfoPane.html]
awkaw
  • Enthusiast

  • 41 posts
  • Corona SDK

Thank you!




[topic_controls]
[/topic_controls]