| 21480 |
rajender |
1 |
package com.saholic.profittill.BroadcastReceivers;
|
|
|
2 |
|
|
|
3 |
import android.app.AlarmManager;
|
|
|
4 |
import android.app.PendingIntent;
|
|
|
5 |
import android.content.BroadcastReceiver;
|
|
|
6 |
import android.content.Context;
|
|
|
7 |
import android.content.Intent;
|
|
|
8 |
import android.os.SystemClock;
|
|
|
9 |
|
|
|
10 |
import com.saholic.profittill.Services.PollingService;
|
|
|
11 |
|
|
|
12 |
public class PollRestartReceiver extends BroadcastReceiver {
|
|
|
13 |
public PollRestartReceiver() {
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
@Override
|
|
|
17 |
public void onReceive(Context context, Intent intent) {
|
|
|
18 |
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
|
|
19 |
Intent i = new Intent(context, PollingService.class);
|
|
|
20 |
PendingIntent pi = PendingIntent.getService(context, 0, i, 0);
|
|
|
21 |
am.cancel(pi);
|
|
|
22 |
am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 60 * 1000 , 15 * 60 * 1000, pi);
|
|
|
23 |
}
|
|
|
24 |
}
|