Hey,

I have a class that sets an alarm and another class which is called
when the alarm goes off. When I try to compile the program, it says
there is an error in my application but it doesn't show me any
errors.

This is my manifest file :

====================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="gAlert.gAlert"
      android:versionCode="1"
      android:versionName="1.0.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".GCartoon"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="SetAV"></activity>
        <activity android:name="GAlarmReceiver"></activity>
        <receiver class=".GAlarmReceiver" />
        </application>
</manifest>

=====================================================

This is the class that receives the signal  :

=====================================================

package gAlert.gAlert;

import android.content.Context;
import android.content.Intent;
import android.content.BroadcastReceiver;
import android.widget.Toast;

public class GAlarmReceiver extends BroadcastReceiver {
        @Override
        public void onReceive(Context con, Intent in) {
                Toast.makeText(con, "One shot received", 
Toast.LENGTH_SHORT).show();
        }
}

=====================================================


This is the piece of code that tries to set the alarm:


=====================================================

                        Intent intent = new Intent(GAlert.this, 
GAlarmReceiver.class);
                        PendingIntent sender = PendingIntent.getBroadcast(this, 
0, intent,
0);



            // We want the alarm to go off 30 seconds from now.
            Calendar calendar = Calendar.getInstance();
            calendar.setTimeInMillis(System.currentTimeMillis());
            calendar.add(Calendar.SECOND, 30);

                        AlarmManager am = (AlarmManager) 
getSystemService(ALARM_SERVICE);
                        am.set(AlarmManager.RTC_WAKEUP, 
calendar.getTimeInMillis(),
sender);

                        if (mToast != null) {
                                mToast.cancel();
                        }
                        mToast.show();

======================================================


Am I doing anything wrong here? It seems like the error is probably in
my manifest file but I copied it from Android's documentation so I
don't know.

Thanks in advance for all the help.

Regards,
Moazzam
http://moazzam-khan.com/
--~--~---------~--~----~------------~-------~--~----~
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