.
This commit is contained in:
@@ -4,6 +4,7 @@ import static com.app.simplitend.patient_dashboard.DashBoardActivity.LOCATION_RE
|
||||
import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_ID;
|
||||
import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_TAG;
|
||||
import static com.app.simplitend.patientgeofencing.PatientLocationUpdatesReceiver.LOCATION_REQUEST_TAG;
|
||||
import static com.app.simplitend.patientgeofencing.PatientLocationUpdatesReceiver.LOCATION_UPDATES_REQUEST_CODE;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
@@ -113,9 +114,9 @@ public class PatientMainViewModel extends ViewModel {
|
||||
PendingIntent pendingIntent ;
|
||||
|
||||
if(Build.VERSION.SDK_INT > 30){
|
||||
pendingIntent = PendingIntent.getBroadcast(activity, LOCATION_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
||||
pendingIntent = PendingIntent.getBroadcast(activity, LOCATION_UPDATES_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
||||
} else{
|
||||
pendingIntent = PendingIntent.getBroadcast(activity, LOCATION_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
pendingIntent = PendingIntent.getBroadcast(activity, LOCATION_UPDATES_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
fusedLocationClient.requestLocationUpdates(locationRequest, pendingIntent)
|
||||
|
||||
@@ -15,6 +15,8 @@ public class PatientLocationUpdatesReceiver extends BroadcastReceiver {
|
||||
public static final String LOCATION_REQUEST_TAG = "LOCATION_REQUEST_TAG";
|
||||
private static final String LOCATION_EXTRA_KEY = "com.google.android.location.LOCATION";
|
||||
|
||||
public static final int LOCATION_UPDATES_REQUEST_CODE = 1010;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d(LOCATION_REQUEST_TAG, "LOCATION UPDATE RECEIVED");
|
||||
|
||||
Reference in New Issue
Block a user