Hi, I am creating just a simple android app which will respond to
received. I am using braodcastreceiver to receive sms. Code for
activity is

package com.om;

import android.app.Activity;

import android.content.BroadcastReceiver;

import android.content.Context;

import android.content.Intent;

import android.content.IntentFilter;

import android.os.Bundle;

import android.widget.Toast;

import android.telephony.SmsManager;

import android.telephony.SmsMessage;

public class MyTest extends Activity {

public static final String SMS_RECEIVED =

"android.provider.Telephony.SMS_RECEIVED";

/** Called when the activity is first created. */

BroadcastReceiver smsReceiver =

  new BroadcastReceiver() {

  @Override

  public void onReceive(Context _context, Intent _intent) {

  System.out.println("SMS Received");

  }

  };

@Override

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    IntentFilter filter = new IntentFilter(SMS_RECEIVED);


    registerReceiver(smsReceiver, filter);

}

}

When i Run this activity on SDK 2.1 AVD and sends SMS to that port it
says Force close. Please tell me what is error in code. Thanks in
advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to