how to grant permission for background location react native - react-native

I'm struggling to publish the app to google play because of that permission request.
I have provided location permission asks. but it has only 2 label options allow/reject.
as far as I see I need to put getBackgroundPermissionOptionLabel() with more options.
followed: https://developer.android.com/training/location/permissions#foreground
how do I do that on react native?

Related

Is there a way to not request location permission after LOCATION_WHEN_IN_USE permission has been granted on the system settings, on an Expo Project?

I am doing a react native project on expo. When a user have a "never" permission on the phone, when pressing share location button, the app asks if the user wants to change location manually and if "yes" the app redirects to system settings.
However when the user turns back and I try to access location through method getCurrentPositionAsync (expo-location library) and I still see the "LOCATION_FOREGROUND permission is required to do this operation" error, even though the LOCATION_WHEN_IN_USE permission has been granted on the system settings, because my app has not requested the permission through the expo-location API.
Is there a way to achieve this on an expo project, without having to ask twice? (testing on iphone)

React Native Expo - Location service

Im trying to submit an app to google play console but it is showing an error ->
This release includes permissions that haven't been declared in Play Console. Go to Sensitive app permissions to update your permission declarations.
But Im not asking the user for any location permission or have any code to do the same.
The closest thing that Im getting from the user is their timezone using expo-localization
Is there a way to fix is ?

How Expo(React Native) can access gallery and external storage without CAMERA_ROLL permission?

I have a terrible question..
I hope there is anyone who know this problem..
In EXPO App which is a wrapper API for React Native,
How can Expo Image picker example app can access Gallery(external storage) without requesting any external storage access permission to user???
original source code is here..
https://docs.expo.io/versions/latest/sdk/imagepicker/
I tried with removing any askAsync(CAMERA_ROLL.permission) or getAsync(CAMERA_ROLL.permission).
So the example app has no permission about accessing external storage...
BUT!! I press the button, It access the Gallery....
How can it be possible??
I double check permission on the app, but there is no granted permission to external storage...
Please let me know...
I think it is the appropriate thing which firstly asked permission, then access the external storage..
P.S I tested it with android phone only.
i have never checked permissions..
To stop expo app from having this permission, do the following:
Remove all reference to the permission requests (That you already did)
Remove the Image launcher (but it seems you don't want to do that)
Clear the expo application permission of media access
Step 3 is what you are looking for, to clear application settings go to your phones settings -> application management -> select expo app -> permissions and clear the gallery/media permission.
Now when you run the application again you will not be able to access the gallery even if you press the button as you mentioned and if you include the getAsync to request for permission you will be prompt with asking for permission.
EDIT:
To explicitly set permissions for stand alone applications modify your app.json file and add the "permissions" parameter under the android configurations there, by default expo uses all permissions of your device. specify there the permissions you want your application to have.
Please refer to this link for further details on how to configure your app.json file.
Hope this helps!

How can I request iOS storage permission in react native?

I have found a package called react-native-permissions which gives most of the permissions in Android and iOS. Currently it is not supporting Storage permission in iOS. How can I request iOS storage permission in react native?
You need to add the following fields in your plist.
<key>NSPhotoLibraryAddUsageDescription</key>
<string>*your app name* would like to save photos from the app to your gallery</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>*your app name* would like to access your photo gallery for uploading images to the app</string>
If you want to save data you don't need any permission for that on iOS, it is allowed by default. Source It is the only reason why it is not supported by react-native-permissions.

Where to configure deep link URL schema in React Native / Expo

I want to create a deep link in my react native app so a user can share a URL and then the other person can open this url and have the intended app open.
I am following this tutorial and they say info.plist needs to be edited with a URL schema.
However, I believe this is only for IOS? And also I don't believe I have access to these files when using Expo?
How can I specify my url schema and achieve deep linking in Expo?