AlarmManager not working while setting the interval time and canceling it in other activity
<p>I am calling a webservice for every 30 seconds using alarm manager.I register it on the time of login in the application. But it is getting called for every 3 seconds. Further, In other activity i am cancelling it but it is not getting cancelled also.</p>

<p>Code for register :</p>

<pre><code>Intent intent = new Intent(this, MyBroadcastReceiver.class); 
intent.putExtra("usrid", getIntent().getStringExtra("usrid")); 
PendingIntent pendingIntent =PendingIntent.getBroadcast(this.getApplicationContext(), 234324243, intent, 0); 
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+2000, 30*1000, pendingIntent); 
Toast.makeText(this, "Alarm set in 10 seconds", Toast.LENGTH_LONG).show();
</code></pre>

<p>and for canceling it the code is :</p>

<pre><code>Intent intent = new Intent(this, MyBroadcastReceiver.class);
intent.putExtra("usrid", getIntent().getStringExtra("usrid"));
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 234324243, intent,0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.cancel(pendingIntent);
</code></pre>

<p>What is the problem. Please help. Thanx in advance.</p>
