I am trying to run am AlarmManager every few seconds, through an activty, using pending intent
and using broadcast receiver to receive the same.

The problem I am facing is that i am sending some that with the intent to the broadcast receiver but I am not able to receive it at the other end.

here is what my activity function looks like:




Code:
 private void createalarm() {
		// TODO Auto-generated method stub
		AlarmManager alarmMgr=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
		Intent i=new Intent(this, MyAlarmReceiver.class); 
		
		String bread = "o yeah";
		Bundle basket = new Bundle();
		basket.putString("key", bread);
		i.putExtras(basket);
		
		PendingIntent pendingi=PendingIntent.getBroadcast(this,0, i, 0);
		Calendar time = Calendar.getInstance();
		time.setTimeInMillis(System.currentTimeMillis());
		time.add(Calendar.SECOND, 10);
		alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, time.getTimeInMillis(),10000, pendingi);
	}
and the code for the broadcast reciever:

Code:
 public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub
		Bundle gotBasket = intent.getExtras();
		String gotBread = gotBasket.getString("key");
		Toast.makeText(context, gotBread , Toast.LENGTH_LONG).show();
Please help !

Also, is it possible to send different data each time to the receiver?

Thank you