use of android.Manifest.permission.ACCESS_FINE_LOCATION in project android_packages_apps_GmsCore by microg.
the class SelfCheckFragment method prepareSelfCheckList.
@Override
protected void prepareSelfCheckList(List<SelfCheckGroup> checks) {
checks.add(new RomSpoofSignatureChecks());
checks.add(new InstalledPackagesChecks());
if (SDK_INT >= 23) {
List<String> permissions = new ArrayList<>();
permissions.add(ACCESS_COARSE_LOCATION);
permissions.add(ACCESS_FINE_LOCATION);
if (SDK_INT >= 29) {
permissions.add(ACCESS_BACKGROUND_LOCATION);
}
permissions.add(READ_EXTERNAL_STORAGE);
permissions.add(WRITE_EXTERNAL_STORAGE);
permissions.add(GET_ACCOUNTS);
permissions.add(READ_PHONE_STATE);
permissions.add(RECEIVE_SMS);
checks.add(new PermissionCheckGroup(permissions.toArray(new String[0])) {
@Override
public void doChecks(Context context, ResultCollector collector) {
super.doChecks(context, collector);
PackageManager pm = context.getPackageManager();
try {
PermissionInfo info = pm.getPermissionInfo("android.permission.SYSTEM_ALERT_WINDOW", 0);
CharSequence permLabel = info.loadLabel(pm);
collector.addResult(context.getString(org.microg.tools.ui.R.string.self_check_name_permission, permLabel), Settings.canDrawOverlays(context) ? Result.Positive : Result.Negative, context.getString(org.microg.tools.ui.R.string.self_check_resolution_permission), fragment -> {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName()));
startActivityForResult(intent, 42);
});
} catch (Exception e) {
Log.w("SelfCheckPerms", e);
}
}
});
}
if (SDK_INT >= Build.VERSION_CODES.M) {
checks.add(new SystemChecks());
}
// checks.add(new NlpOsCompatChecks());
// checks.add(new NlpStatusChecks());
}
use of android.Manifest.permission.ACCESS_FINE_LOCATION in project Osmand by osmandapp.
the class RequestPermissionScreen method onGetTemplate.
@NonNull
@Override
public Template onGetTemplate() {
List<String> permissions = new ArrayList<>();
permissions.add(ACCESS_FINE_LOCATION);
String message = getCarContext().getString(R.string.location_access_request_title);
OnClickListener listener = ParkedOnlyOnClickListener.create(() -> getCarContext().requestPermissions(permissions, (approved, rejected) -> {
if (!approved.isEmpty()) {
LocationPermissionCheckCallback locationPermissionCheckCallback = mLocationPermissionCheckCallback;
if (locationPermissionCheckCallback != null) {
locationPermissionCheckCallback.onPermissionGranted();
}
}
finish();
}));
Action action = new Action.Builder().setTitle(getCarContext().getString(R.string.location_access_request_action)).setBackgroundColor(CarColor.GREEN).setOnClickListener(listener).build();
return new MessageTemplate.Builder(message).addAction(action).setHeaderAction(Action.APP_ICON).build();
}
use of android.Manifest.permission.ACCESS_FINE_LOCATION in project GmsCore by microg.
the class SelfCheckFragment method prepareSelfCheckList.
@Override
protected void prepareSelfCheckList(List<SelfCheckGroup> checks) {
checks.add(new RomSpoofSignatureChecks());
checks.add(new InstalledPackagesChecks());
if (SDK_INT >= 23) {
List<String> permissions = new ArrayList<>();
permissions.add(ACCESS_COARSE_LOCATION);
permissions.add(ACCESS_FINE_LOCATION);
if (SDK_INT >= 29) {
permissions.add(ACCESS_BACKGROUND_LOCATION);
}
permissions.add(READ_EXTERNAL_STORAGE);
permissions.add(WRITE_EXTERNAL_STORAGE);
permissions.add(GET_ACCOUNTS);
permissions.add(READ_PHONE_STATE);
permissions.add(RECEIVE_SMS);
checks.add(new PermissionCheckGroup(permissions.toArray(new String[0])) {
@Override
public void doChecks(Context context, ResultCollector collector) {
super.doChecks(context, collector);
PackageManager pm = context.getPackageManager();
try {
PermissionInfo info = pm.getPermissionInfo("android.permission.SYSTEM_ALERT_WINDOW", 0);
CharSequence permLabel = info.loadLabel(pm);
collector.addResult(context.getString(org.microg.tools.ui.R.string.self_check_name_permission, permLabel), Settings.canDrawOverlays(context) ? Result.Positive : Result.Negative, context.getString(org.microg.tools.ui.R.string.self_check_resolution_permission), fragment -> {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName()));
startActivityForResult(intent, 42);
});
} catch (Exception e) {
Log.w("SelfCheckPerms", e);
}
}
});
}
if (SDK_INT >= Build.VERSION_CODES.M) {
checks.add(new SystemChecks());
}
// checks.add(new NlpOsCompatChecks());
// checks.add(new NlpStatusChecks());
}
use of android.Manifest.permission.ACCESS_FINE_LOCATION in project OsmAnd by osmandapp.
the class RequestPermissionScreen method onGetTemplate.
@NonNull
@Override
public Template onGetTemplate() {
List<String> permissions = new ArrayList<>();
permissions.add(ACCESS_FINE_LOCATION);
String message = getCarContext().getString(R.string.location_access_request_title);
OnClickListener listener = ParkedOnlyOnClickListener.create(() -> getCarContext().requestPermissions(permissions, (approved, rejected) -> {
if (!approved.isEmpty()) {
LocationPermissionCheckCallback locationPermissionCheckCallback = mLocationPermissionCheckCallback;
if (locationPermissionCheckCallback != null) {
locationPermissionCheckCallback.onPermissionGranted();
}
}
finish();
}));
Action action = new Action.Builder().setTitle(getCarContext().getString(R.string.location_access_request_action)).setBackgroundColor(CarColor.GREEN).setOnClickListener(listener).build();
return new MessageTemplate.Builder(message).addAction(action).setHeaderAction(Action.APP_ICON).build();
}
use of android.Manifest.permission.ACCESS_FINE_LOCATION in project forgerock-android-sdk by ForgeRock.
the class DeviceProfileCallbackFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_device_profile_callback, container, false);
message = view.findViewById(R.id.message);
progressBar = view.findViewById(R.id.collectingDeviceProfileProgress);
if (node.getCallbacks().size() == 1) {
// auto submit if there is one node
progressBar.setVisibility(View.VISIBLE);
message.setText(callback.getMessage());
} else {
progressBar.setVisibility(GONE);
message.setVisibility(GONE);
}
if (callback.isLocation()) {
if (ContextCompat.checkSelfPermission(getContext(), ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// We don't have permission.
if (shouldShowRequestPermissionRationale(ACCESS_FINE_LOCATION)) {
AlertDialog alertDialog = new AlertDialog.Builder(getContext(), R.style.AlertDialogTheme).setMessage(R.string.request_location_rationale).setPositiveButton("Proceed", (dialog, which) -> requestLocationPermission()).setNegativeButton("Deny", (dialog, which) -> proceed()).create();
alertDialog.show();
} else {
requestLocationPermission();
}
} else {
// Location permission is granted, proceed.
proceed();
}
} else {
proceed();
}
return view;
}
Aggregations