I have created one main class which extends activity. Another class
which extends BroadcastReceiver. The code of it is as below.



import android.app.NotificationManager;
import android.content.*;
import android.app.Notification;
import android.widget.*;


public class AlarmReceiver extends BroadcastReceiver{
    // Display an alert that we've received a message.
   // @Override
   ReceiveSMS sms=new ReceiveSMS();

    public void onReceive(Context context, Intent intent){
        System.out.println("Receive");

       NotificationManager nm = (NotificationManager)
        context.getSystemService(Context.NOTIFICATION_SERVICE);
       System.out.println("Message Received");

        Notification nm1=new Notification(R.drawable.ab,"Message
Received",1000);
        nm.notify(3, nm1);
        //nm.no
  //      sms.display();

   }
}

The following is my androidmanifiest.xml file.


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="com.android.ReceiveSMS"
      android:versionCode="1"
      android:versionName="1.0.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

        <activity android:name=".ReceiveSMS"
                  android:label="@string/app_name">

        </activity>
        <receiver android:name=".AlarmReceiver">
         </receiver>
    </application>
</manifest>




I did not get any error at the compilation time but when i run the
programme in eclipse . It does not get any user input. I thought that
it should invoked when i will send sms to that emulator but yet it
does not invoke. I hope some one will reply me as early as possible.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to