Alarm Not Working
<p>I write the following code.
I declared BroadcastReciever in manifest still it is not working.
I am a begginer and stucked for 2 hours.
What problems could be here?</p>

<pre><code>// My launcher activity
public class AlarmMainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        AlarmManager am=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
        GregorianCalendar gc=new GregorianCalendar();
        gc.set(2012, 1, 14, 11, 28);

        Intent intent=new Intent(this, AlarmService.class);
        gc.set(Calendar.AM_PM, 0);

        PendingIntent sender=PendingIntent.getBroadcast(this, 1, intent, 0);
        am.set(AlarmManager.RTC_WAKEUP, gc.getTimeInMillis(), sender);
        System.out.print(gc);
    }
}

// broadcast reciever class

public class AlarmService extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Toast.makeText(context, "Alarm started", 2000).show();
    }
}
</code></pre>
