Internet background check
-
What methods do you need to use to make a background application check the Internet every n hours?
-
One way:
Intent intent = new Intent(context, myService.class); PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0); AlarmManager alarmManager = mContext.getSystemService(Context.ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME, 3600000, 3600000, pendingIntent)
It'll start myService service every hour. And in this service, check the data from the Internet.