• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Coding simple sms Listener problem!!

card3r

Lurker
Hello there coding folks!!! Recently I bought a HTC Desire phone and I begun coding an Incoming SMS Listener. The main purpose is analizing the contents of an sms; if the text matches the requiered word combination, it would send GPS coordonates to a certain phone number. Unfortunately, the app crashes without error reporting, even if I used those try/catch methods(try...catch...Toast.makeToast(context,exception.toString...)). I would really need some help....
I'm using android SDK v1.6(Google APIs) and i attached also my work. Need urgent help!!!
 

Attachments

Do you understand how to set up an SMS Receiver? In your manifest, within the application pool, you must declare your Receiver
Code:
<receiver android:name=".SmsReceiver">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>

The .SmsReceiver is your new class to handle the receiving SMS'

This will also require a permission
Code:
<uses-permission android:name="android.permission.RECEIVE_SMS" />

Now that you've directed your SMS handler to your custom class, it must extend "BroadcastReceiver". You now override the onReceive method to handle the message how you want to. You'll have to iterate through the intent pdus
 
Back
Top Bottom