Expo: My app got rejected from google play about location policy - android

My app contains a plugin for maps and it doesn't require user location permission. However, Google Play rejected it because my app isn't compliant with the Location permissions policy.
The following is the code I write, which doesn't require user location.
import MapView from 'react-native-maps';
<MapView region={this.state.mapRegion}>
<MapView.Marker coordinate={this.state.marker} />
</MapView>
Is there anyone who can provide advice? Thank you.

Please add permissions=[] in your App.json (in android) and try again.
"android": {
"permissions": [],
"package": "com.xxxxxx.xxxxx"
}

You can set app permission required in app.json
If permission is not defined in app.json, the default permission will include all except ACCESS_BACKGROUND_LOCATION
{
"android": {
"package": "xxx.yyy.zzz"
}
}
If an empty array is provided, only these permissions will be included:
• receive data from Internet (fetch)
• view network connections (expo-network)
• full network access (expo-network/fetch)
• change your audio settings (expo-av)
• prevent device from sleeping (expo-keep-awake)
{
"android": {
"package": "xxx.yyy.zzz",
"permissions": []
}
}
If you don't want to include all permissions, you can customize in the permissions field
{
"android": {
"package": "xxx.yyy.zzz",
"permissions": [
"CAMERA",
"RECORD_AUDIO",
"READ_EXTERNAL_STORAGE",
"WRITE_EXTERNAL_STORAGE"
]
}
}
ref: https://docs.expo.io/versions/latest/config/app/#permissions

Related

Get location details using Android Management API

I'm new to Android Management API and I'm unable to figure out how to get the location details using Android Management API. I have tried updating policy as such :
policy_json = '''
{
"applications": [
{
"packageName": "com.google.samples.apps.iosched",
"installType": "FORCE_INSTALLED",
"permissionGrants": [
{
"permission": "android.permission.ACCESS_FINE_LOCATION",
"policy": "GRANT"
}
}
],
"locationMode": "HIGH_ACCURACY"
}
'''
But I don't seem to have gotten the location details. Can anybody please help me through? Thank you!
The value HIGH_ACCURACY is only available in Android 8 or below. If you are using Android 9 or above, you should use LOCATION_ENFORCED instead.
Additionally, please note that locationMode only works on company owned devices.
Please refer to this link for more information.

Android Management Device Provision Fail

I used this quick start guide to setup my project and enterprise. Currently the project is under 'No Organization' on the Google Cloud Console hierarchy.
I have setup the following device policy with a single app in kiosk mode. The app is restricted to a single country and is developed in-house.
{
"safeBootDisabled": true,
"screenCaptureDisabled": true,
"factoryResetDisabled": true,
"systemUpdate": {
"type": "WINDOWED",
"startMinutes": 0,
"endMinutes": 240
},
"applications": [
{
"packageName": "com.xxx.yyy",
"installType": "KIOSK",
"defaultPermissionPolicy": "GRANT"
}
],
"debuggingFeaturesAllowed": true,
"funDisabled": true,
"appAutoUpdatePolicy": "WIFI_ONLY",
"kioskCustomization": {
"statusBar": "NOTIFICATIONS_AND_SYSTEM_INFO_ENABLED"
}
}
I currently use the QR method to provision devices.
The problem I am having is that the provisioning process is failing at the stage when the app is being installed.
When I use this API to check what went wrong I can see that it failed because of the following error:
{
"nonComplianceDetails": [
{
"settingName": "applications",
"nonComplianceReason": "APP_NOT_INSTALLED",
"packageName": "com.xxx.yyy",
"installationFailureReason": "NOT_AVAILABLE_IN_COUNTRY"
},
{
"settingName": "persistentPreferredActivities",
"nonComplianceReason": "APP_NOT_INSTALLED",
"packageName": "com.xxx.yyy"
}
]
}
If I change my device policy from install type "KIOSK" to "AVAILIBLE" the device is successfully provisioned. I can then install the app from the Play store and reset the install type to "KIOSK" mode.
But this is far from ideal because the entire device fleet of 85 production devices settings', are then changed just to provision a single device.
So it seems that while provisioning the device the location settings are incorrect?
Does anybody know why this is happening?
Try to create a separate policy just for this device so that you can provision it without affecting other devices, and once provisioned, you can update which policy is applied to the device to be the same to all other devices.
You can use policies.patch to update the policy or devices.patch.
This also could be for a lack of Kiosk support mode for a given app as KIOSK required the app to have an official “lock task mode” per https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode.

ReactNative Expo app wrongly listed details in Play Console

I've uploaded a React Native app built in via Expo. I've set permissions to none:
{
"expo": {
"android": {
"permissions": []
... other settings
}
... other settings
}
And I've set it to portrait mode only:
{
"expo": {
"orientation": "portrait",
... other settings
}
}
But when I upload the app-bundle to the PLayConsole it lists the app with 15 permissions:
android.permission.ACCESS_NETWORK_STATE
android.permission.ACCESS_WIFI_STATE
android.permission.FOREGROUND_SERVICE android.permission.INTERNET
android.permission.MODIFY_AUDIO_SETTINGS
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.REQUEST_INSTALL_PACKAGES android.permission.STORAGE
android.permission.SYSTEM_ALERT_WINDOW
android.permission.USE_BIOMETRIC android.permission.WAKE_LOCK
com.google.android.c2dm.permission.RECEIVE
com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE
com.sja.firstaid.permission.C2D_MESSAGE
host.exp.exponent.permission.C2D_MESSAGE
and both orientations under features:
2 features: android.hardware.screen.landscape,
android.hardware.screen.portrait
I cannot identify a reason for either of these settings to be ignored.
Note: permissions key appear to ignore permission instead of add permission list Docs
List of additional permissions the standalone app will request upon installation,
along with the minimum necessary for an Expo app to function.
To use ALL permissions supported by Expo, do not specify the "permissions" key.
To use ONLY the following minimum necessary permissions and none of the extras supported
by Expo, set "permissions" to []. The minimum necessary permissions do not require a
Privacy Policy when uploading to Google Play Store and are:
• receive data from Internet
• view network connections
• full network access
• change your audio settings
• draw over other apps
• prevent device from sleeping
To use the minimum necessary permissions ALONG with certain additional permissions,
specify those extras in "permissions", e.g.
["CAMERA", "RECORD_AUDIO"]
ExpoKit: to change the permissions your app requests, you'll need to edit
AndroidManifest.xml manually. To prevent your app from requesting one of the
permissions listed below, you'll need to explicitly add it to `AndroidManifest.xml`
along with a `tools:node="remove"` tag.
"permissions": [
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION",
"CAMERA",
"MANAGE_DOCUMENTS",
"READ_CONTACTS",
"READ_CALENDAR",
"WRITE_CALENDAR",
"READ_EXTERNAL_STORAGE",
"READ_PHONE_STATE",
"RECORD_AUDIO",
"USE_FINGERPRINT",
"VIBRATE",
"WAKE_LOCK",
"WRITE_EXTERNAL_STORAGE",
"com.anddoes.launcher.permission.UPDATE_COUNT",
"com.android.launcher.permission.INSTALL_SHORTCUT",
"com.google.android.c2dm.permission.RECEIVE",
"com.google.android.gms.permission.ACTIVITY_RECOGNITION",
"com.google.android.providers.gsf.permission.READ_GSERVICES",
"com.htc.launcher.permission.READ_SETTINGS",
"com.htc.launcher.permission.UPDATE_SHORTCUT",
"com.majeur.launcher.permission.UPDATE_BADGE",
"com.sec.android.provider.badge.permission.READ",
"com.sec.android.provider.badge.permission.WRITE",
"com.sonyericsson.home.permission.BROADCAST_BADGE"
],

Exception occurred while executing exported method askAsync on module ExpoPermissions: null

I'm having an error while using the ExpoPermission interface. I just started to learn about Android development with React and Expo, followed a guide to create a new project
npm install -g create-react-native-app
create-react-native-app my-app
cd my-app/
npm start
Everything worked, and the example run on my phone, then i just added a simple button that calls the example from the expo documentation, but it launches this message when i press it.
[Error: Encountered an exception while calling native method: Exception occurred while executing exported method askAsync on module ExpoPermissions: null]
My code is simple, just added to the view
<TouchableOpacity onPress={handlePressMe} style={styles.helpLink}>
<Text style={styles.LinkBlue}>
Press me!
</Text>
</TouchableOpacity>
Then added the code:
function handlePressMe() {
request_storage_runtime_permission();
}
async function request_storage_runtime_permission() {
try {
const granted = await Permissions.askAsync(Permissions.WRITE_EXTERNAL_STORAGE);
print(granted)
Alert.alert("Storage Permission received.");
/*if (granted === PermissionsAndroid.RESULTS.GRANTED) {
Alert.alert("Storage Permission Granted.");
}
else {
Alert.alert("Storage Permission Not Granted");
}*/
} catch (err) {
console.warn(err)
}
}
And import * as Permissions from 'expo-permissions';
I've read the documentation of Expo, and found many installs that said to do for this library, but none has changed anything, just in case, both things i've added
sudo expo install expo-permissions
sudo yarn add react-native-unimodules
Also to note that i added the permission to app.json, and tried to use getAsync to see if it had been granted, but launched the same error, this is my app.json:
{
"expo": {
"name": "Test App",
"slug": "testApp",
"privacy": "public",
"sdkVersion": "35.0.0",
"platforms": [
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"android": {
"permissions": [
"WRITE_EXTERNAL_STORAGE"
]
}
}
}
Tried searching for more info, but only thing i found are unanswered topics. Does anyone knows what is the problem, or how to prompt more info? Only thing it shows is null.
After trying to do it directly with React Native, i found the problem here:
Expo uses it's own way to name permissions, so if you want to request for WRITE_EXTERNAL_STORAGE, while on RN you would call exactly for this permission, on Expo you need to ask for CAMERA_ROLL permission instead, which includes both Write and Read permissions. The error message is little intuitive, since it only marks null, while trying to say that you're sending a null as parameter due to the
permission that you are requesting (Permissions.WRITE_EXTERNAL_STORAGE) returning null. So the solution was to change it to:
const granted = await Permissions.askAsync(Permissions.CAMERA_ROLL);
Hope this helps someone on the future.

Unable to install apk after device provisioning (Android 8.0)

We are developing a COSU app using Android Management API and QR code provisioning. We're planning to distribute app with private Google play, but for now I'm trying to make it work with manual installation using apk. That's how it should work:
A client receives qr code from us, that applies policy without restrictions to the device.
After provisioning client downloads apk from some other source (probably via email) and installs it.
Client applies policy with restrictions from app with call to API.
So, I'm stuck on second step - an attempt to install downloaded apk leads to this error:
Default policy seems to be ok:
{
"name": "enterprises/<enterpriseName>/policies/policy_unlocked",
"version": "11",
"applications": [
{
"packageName": "com.axmor.fsinphone",
"installType": "AVAILABLE",
"defaultPermissionPolicy": "GRANT"
}
],
"persistentPreferredActivities": [
{
"receiverActivity": "com.axmor.fsinphone",
"actions": [
"android.intent.action.MAIN"
]
}
],
"systemUpdate": {
"type": "WINDOWED",
"startMinutes": 120,
"endMinutes": 240
},
"debuggingFeaturesAllowed": true
}
]
}
And this policy is applied to device:
"policyName": "enterprises/<enterpriseName>/policies/policy_unlocked",
"appliedPolicyName": "enterprises/<enterpriseName>/policies/policy_unlocked",
What I've tried:
Installing release apk and signed apk (same result)
Installing apk with adb from Android studio - this works, but it's not what I want.
(copying the solution here from comments)
To be able to install apps from outside the Play Store you need to set installUnknownSourcesAllowed to true in the Policy. More details in the policy references.

Categories

Resources