Код: Выделить всё
Starting FGS with type location callerApp=ProcessRecord{22f416f 27792:smartsense.co.in.sensephone:remote/u0a255} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_LOCATION] any of the permissions allOf=false [android.permission.ACCESS_COARSE_LOCATION, android.permission.ACCESS_FINE_LOCATION] and the app must be in the eligible state/exemptions to access the foreground only permission
Насколько я понял, ссылаясь на документацию https://developer.android.com/develop/b ... ices#start Мы должны проверить наличие разрешений, предоставляемых или нет.if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
if (Utils.checkLocationPermission(this)) {
ServiceCompat.startForeground(this, AUTO_ATTENDANCE_ID, getNotification(getString(R.string.please_enable_gps), activityPendingIntent), FOREGROUND_SERVICE_TYPE_LOCATION);
} else {
Utils.appendLog(TAG, "Location permissions denied for ASIOFS to start", this);
}
} else {
startForeground(AUTO_ATTENDANCE_ID, getNotification(getString(R.string.please_enable_gps), activityPendingIntent));
}
< /code>
utils.checklocationpermission () имеет следующий код. < /p>
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
return PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION)
&& PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_BACKGROUND_LOCATION);
} else {
return PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION);
}
< /code>
Что случилось? ) и в документации они предложили использовать разрешение checkecker.checkselfpermission ().
Если вы какое -либо возможное решение, дайте мне знать.
Подробнее здесь: https://stackoverflow.com/questions/791 ... andorid-14