Receive SMS
in
Android Processing
•
2 years ago
I am trying to build an app that sends and receives an sms, and sending was straight forward with a few lines of code but receiving is more difficult. I found a good tutorial at
http://mobiforge.com/developing/story/sms-messaging-android and I have it almost working but I don't know how to integrate it with processing. I created a separate file in the sketch folder, called SmsReceiver.java with a class definition of SmsReceiver. I also added
<receiver android:name=".SmsReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
to the manifest. The SmsReciver class has an OnReceive method that is invoked when an sms is received, and this method shows the sms with the line
Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
So far so good, but I only see the sms on the screen. I would like to get the text message inte draw() in the processing code, not only in the separate SmsReceiver class. I have no idea how to do this integration. Ideas, anyone?
1