1. Check out our companion app, Forums for Android! Download from Google Play

Coding simple sms Listener problem!!

Discussion in 'Application Development' started by card3r, Jun 1, 2010.

  1. card3r

    card3r New Member
    Thread Starter

    Jun 1, 2010
    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!!!

    Attached Files:


  2. whitey

    whitey New Member

    Jun 1, 2010
    Do you understand how to set up an SMS Receiver? In your manifest, within the application pool, you must declare your Receiver
    Code (Text):
    1. <receiver android:name=".SmsReceiver">
    2.             <intent-filter>
    3.                 <action android:name="android.provider.Telephony.SMS_RECEIVED" />
    4.             </intent-filter>
    5.         </receiver>
    The .SmsReceiver is your new class to handle the receiving SMS'

    This will also require a permission
    Code (Text):
    1. <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

Share This Page