i develop one application that application need all time execute service but unfortunatly when app closed or remove from heap space services will be destroyed. please anyone help me solve his problem
Intent alarm1 = new Intent(context, LocationReceiver.class); boolean alarmRunning1 = (PendingIntent.getBroadcast(context, 0, alarm1, PendingIntent.FLAG_NO_CREATE) != null); //if (alarmRunning1 == false) { PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, alarm1, 0); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), 5000, pendingIntent); // //} here first alaram manager using call the receiver class //Alaramreceiver.java public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { //Log.e("sucess", "success"); Intent background = new Intent(context, BackgroundService.class); context.startService(background); } } //then call service class BackgroundService.java => service class is used to check the server and post values to server. if new value will come means display the notification please anyone help me -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/6e5b2490-038d-47d1-829a-2310dbe4ff32%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.