Run GPS listener in background on Android
I would like to know how to receive GPS when the Android app is in the background. Is there a complete tutorial to explain it? Siddharth You need to use a AlarmManager to activate a pending intent (via a broadcast receiver) to launch a background service. Some sample code for you In your MainActivity AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); Intent notifyintent = new Intent(this, OnAlarmReceiver.class); notifyintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); notifyintent.setAction("android.intent.action.NOTIFY"); PendingIntent notifysender = PendingIntent.getBroadcast