Permission Not Granted by Manifest (Api Level 22) - android

I am trying to log some actions to /sdcard. My AndroidManifest.xml specifies android:targetSdkVersion="22" and includes
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="<REDACTED-MYPACKAGENAME>"
android:versionCode="100"
android:versionName="1.00">
<uses-sdk android:targetSdkVersion="22"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
More...
Unfortunately, my writes to /sdcard/events.txt cause exception
java.io.FileNotFoundException: /sdcard/events.txt: open failed: EACCESS (Permission denied)
Notes:
Since the API level is <23, I believe run-time-permissions are not required.
If I manually enable "Storage" using "Settings"->"Apps->MyApp->"Permissions", it works just fine.
I am running on a Samsung S-9 running Android V10.
What am I missing?

Related

Android App requests more permissions than in manifest specified

Im confused. My Manifest looks like this (App-Name removed):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2" android:versionName="0.8.2" package="com.xxxxxxx.xxxx" android:installLocation="auto">
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="30" />
<application android:label="LABEL" android:theme="#style/MainTheme" android:usesCleartextTraffic="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
But if I open the "permission" page in App-Store, it shows that the App "may use" storage permission.
My App doesnt need any access to external storage. Why this permission is listet in the store (and also in the app-settings after installation)?
How can I remove this? Its confusing for the users.

Install Referrer Library v1.1 adds permissions

Updating the Install Referrer Library from v1.0 to v1.1 added the following permissions:
WRITE_EXTERNAL_STORAGE
READ_EXTERNAL_STORAGE
READ_PHONE_STATE
Those permissions are not present in the Install Referrer Library manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.installreferrer" >
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />
<application />
</manifest>
Source:
https://mvnrepository.com/artifact/com.android.installreferrer/installreferrer/1.1
Why those permissions added to the merged manifest?
This is because they have added a dependency to
com.google.android.gms:play-services-measurement:17.2.1
Which adds those permissions.
You can find it on the file:
manifest-merger-blame-debug-report.txt
which is under "yourApp/build/intermediates/manifest_merge_blame_file/debug
It's probably a bug. I currently just downgraded back to 1.0.
But if you need this version you can add
<uses-permission android:name="<permission_name>" tools:node="remove" />
To disable it.
Know that if you'll use any API which needs it inside the library it could lead to a crash so i won't recommend doing so.
Version 1.1 and 1.1.1 are missing "minSdkVersion". This would automatically add those permissions. See similar issue here: Google Play Services 12.0.1.
Solution
Version 1.1.2 solves this issue.
Details
Manifest.xml for v1.0 (from https://mvnrepository.com/artifact/com.android.installreferrer/installreferrer/1.0)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.installreferrer" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="22" />
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />
<application />
</manifest>
Manifest.xml for v1.1 (from https://mvnrepository.com/artifact/com.android.installreferrer/installreferrer/1.1)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.installreferrer">
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />
<application />
</manifest>

App is not asking for internet permission at installation

I have an Android app written by Xamarin, and it works perfectly fine when debugging.
But when I want to release it, my *.apk installer does not ask for INTERNET permission, therefore my app crashes whenever it requires connection, which is almost in every activity since it's an online app.
I have added the permission in my manifest file, but for some reason, the app only asks for Reading and Writing data from SD card permission and totally ignores internet permission.
Here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ComicCity.ComicCity" android:versionCode="1" android:versionName="1.0" android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.DELETE_CACHE_FILES" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="ComicCity" android:icon="#drawable/CCicon"></application>
</manifest>
Internet is in the normal permissions list and thus you will not get prompted as it is auto-granted
If an app declares in its manifest that it needs a normal permission, the system automatically grants the app that permission at install time. The system does not prompt the user to grant normal permissions, and users cannot revoke these permissions.
Re: https://developer.android.com/guide/topics/permissions/normal-permissions.html

Android emulator web cam is not detected

I am new to android development. I am creating Scandit barcode scanner application which is using android emulator's camera (webcam).
I have configured camera permissions related stuffs in AndroidManifest.xml file as below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="AndroidDemo.AndroidDemo" android:installLocation="auto">
<uses-sdk android:minSdkVersion="10" />
<application android:label="AndroidDemo"></application>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</manifest>
Now the logcat showing the following error:
07-21 13:21:03.026 E/EmulatedCamera_QemuClient( 63): queryStart: Query failed: Cannot start the camera
07-21 13:21:03.026 E/EmulatedCamera_QemuDevice( 63): startDevice: Unable to start device 'AndroidEmulatorVC0' for NV21[640x480] frames
Initially it was working fine.now i didnt change any code but it is not working. The camera functionality is randomly working.I am not sure how to troubleshoot this.
And my emulator config is given below(visual studio):
And related question is not answered
Thanks.

Installer is not showing all the permissions I request (Android)

This is my section of permissions of my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.adelco.ventamovil"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.INSTALL_PACKAGES"></uses-permission>
<uses-permission android:name="android.permission.DELETE_PACKAGES"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
But when I try to install the package, the wizzard only shows the Internet and Write External Storage permissions.
The DDMS perspective throws this warning message when I install the application:
03-28 10:48:36.627: WARN/PackageManager(144): Not
granting permission android.permission.INSTALL_PACKAGES to package
com.adelco.ventamovil (protectionLevel=3 flags=0xbe44)
03-28 10:48:36.627: WARN/PackageManager(144): Not granting permission
android.permission.DELETE_PACKAGES to package com.adelco.ventamovil
(protectionLevel=3 flags=0xbe44)
What is happening here....?
Thanks!!
Sorry,
Install, delete packages are system permissions. You won't be able to obtain them unless your app is signed with the device's platform certificate (which is impossible unless you have access to the manufacturer's signing cert).
As you can imagine, that'd be a serious security problem if an arbitrary application could silently install other applications.
The best you can do is send the user to the package install page and let them take action if they wish. Take a look at this action intent you can send to start this process for install,
http://developer.android.com/reference/android/content/Intent.html#ACTION_INSTALL_PACKAGE
and for uninstall,
http://developer.android.com/reference/android/content/Intent.html#ACTION_UNINSTALL_PACKAGE
INSTALL_PACKAGES and DELETE_PACKAGES are either in the group signature or signatureOrSystem and thus can't be granted to an "ordinary" app:
A permission that the system grants only to applications that are in the Android system image or that are signed with the same certificates as those in the system image
See android:protectionLevel.
Did you put your permissions like that?
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.your.package"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Categories

Resources