Android Permissions Denial - android

I am trying to read data from Google Play Music Database using ContentProvider. I have included the READ_EXTERNAL_STORAGE permission within my Manifest file but, at crash, the logcat shows that the permission is not provided. Do I need to use the "Requesting Permission at runtime". If yes, how?
Error message:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.ryanbansal.mymusic/com.app.ryanbansal.mymusic.Requested}: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/audio/albums from pid=11192, uid=10240 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.ryanbansal.mymusic">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:hardwareAccelerated="true"
android:allowBackup="true"
android:icon="#drawable/headphonesicon"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".Home">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Requested"
android:label="Requested Results" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".Home"/>
</activity>
<activity
android:name=".Webpage"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="More info"
android:theme="#style/FullscreenTheme" >
</activity>
<service
android:name=".MyIntentService"
android:enabled="true"
android:exported="false" />
</application>

I would comment, but not enough reputation yet, but here is the documentation on runtime permissions for api 23 plus. Supplementary reponse building on #Tharkius comment:
https://developer.android.com/training/permissions/requesting.html

There's a very cool easy-to-use library for managing runtime permissions. Follow the documentation in that link, all you need to know is there, and you'll see how super easy it is to set up and use :D

Related

why always app has been rejected and wasn't published due to a policy violation:

I am trying to upload apk on playstore from few days. but now days its showing list of core functionality in deceleration form like SMS and call log.
but in our apk there is no use of such permissions. I am using Internet and Fine Location permission, but its not listed there. there is compulsion that we require to select atleast one permission.therefore I am selecting Default SMS handler.
even I search through many tools there is no SMS and call log permission is used in whole source code.
As I found many answer on google that Make sure your SMS permission is given in manifest and give the pop up in user level.
but there is no permission in my manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.demmyname.com">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!--<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="com.demmyname.com.Classes.Application"
android:allowBackup="true"
tools:replace="android:allowBackup"
android:icon="#mipmap/icon"
android:label="#string/app_name"
android:roundIcon="#mipmap/icon"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".Activities.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity android:name=".Activities.Activity_Login" />
<activity android:name=".Activities.Activity_SignUp" />
<activity android:name=".Activities.Activity_Forgot_Pwd" />
<activity android:name=".Activities.Activity_Profile" />
<activity android:name=".Activities.Activity_Change_Password" />
<service
android:name=".Services.AppLocationService"
android:enabled="true" />
<activity android:name=".Activities.Activity_Chnage_Location" />
<activity android:name=".Activities.Activity_Order_Delivary" />
<activity android:name=".Activities.Activity_Order_PichUp" />
<activity android:name=".Activities.Activityz_Hotel_Categories" />
<activity android:name=".Activities.Activity_Category_Items" />
<activity android:name=".Activities.Activity_Cart_List" />
<activity android:name=".Activities.Activity_Place_Order" />
<activity android:name=".Activities.Activity_MyOrders" />
<activity android:name=".Activities.Activity_About_Us" />
<activity android:name=".Activities.Activity_View_Offer"></activity>
<!--
<meta-data
android:name="io.fabric.ApiKey"
android:value="7aa3cad21d26b0edcfccea540b57016907999433"
/>
-->
<!-- <meta-data android:name="firebase_crash_collection_enabled" android:value="false" /> -->
<activity android:name=".Activities.Activity_PayUMoney"></activity>
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
</application>
</manifest>
I am looking for solution how to skip declaration form or without selecting core functionality.
To make sure if any other libraries are using the violated permissions, do the following...
In your Android Studio, open the manifest file and observe that in the below of the page 2 (two) Tabs are there =>
Text
Merged Manifest
Click on the Merged Manifest tab. Then search for the
uses-permission
Check that if it contains any call log or sms permissions (or other violated permissions).
If you find any use of the violated permissions like that, add the following line in your manifest under the
manifest tag
<uses-permission android:name="android.permission.READ_SMS" tools:node="remove" />
And for each and every violated permission add another line like the above with the appropriate permission tag.
Then rebuild the project and check that your merged manifest does not contain any violated permissions. After the confirmation generate signed APK and update your application in the Google Play console. (For now, check the do not meet the Google privacy policies in the declaration form).
After a successful update and around after 24 hours, recheck that the form (in Play console) exist or not. There should not be any form after a successful APK update.
You may want to update your APK again after the form disappears for a clear update.

Permission Denial Issue even after adding the required permission in manifest file

Here is the Error Log:
Permission Denial: starting Intent { act=android.settings.WIFI_DISPLAY_SETTINGS cmp=com.android.settings/.Settings$WifiDisplaySettingsActivity } requires com.android.setting.permission.ALLSHARE_CAST_SERVICE
at android.os.Parcel.readException(Parcel.java:1472)
at android.os.Parcel.readException(Parcel.java:1426)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2329)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1426)
at android.app.Activity.startActivityForResult(Activity.java:3513)
at android.app.Activity.startActivityForResult(Activity.java:3474)
at android.app.Activity.startActivity(Activity.java:3716)
at android.app.Activity.startActivity(Activity.java:3684)
Manifest file with Permission:
<uses-sdk android:minSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.setting.permission.ALLSHARE_CAST_SERVICE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:exported="true" >
</activity>
<activity
android:name=".SplashScreenActivity1"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
if your app is having target API level 23 make sure user grants the permission before using them. See RunTimePermission
I hope you are testing this application on samsung device because this permission is only worked on samsung device. As per my knowledge such permission is not exists in the android permission list.
Below is the permission list from android.
http://developer.android.com/reference/android/Manifest.permission.html
Hope this will help you.

More Permissions in uploaded apk than in manifest file

I wanted to update my app but after uploading I noticed that there were additional permissions which I don't mention in my manifest:
android.permission.ACCESS_NETWORK_STATE
android.permission.GET_ACCOUNTS
android.permission.INTERNET
android.permission.READ_EXTERNAL_STORAGE
android.permission.USE_CREDENTIALS
android.permission.WRITE_EXTERNAL_STORAGE
com.google.android.c2dm.permission.RECEIVE
My manifest looks like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.stepscience.yahtzee" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.App" >
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<activity
android:name=".StartActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />
</application>
I only use the permissions for Internet and Network access. Where do the other permissions come from? In the app I use also some google play services like multiplayer and leaderboards. The only changes that I made to the version before were some version updates (gradle,play-services,appcompat) and some xml modifications.
Some permissions are being added by Google Play Services.
You can reduce the permissions it adds by only including the components that you actually need. e.g Google Cast, Google Drive etc
See here for how to do that:
https://developers.google.com/android/guides/setup
Example gradle:
Entire Play Services
compile 'com.google.android.gms:play-services:7.8.0'
Only Games Services
compile 'com.google.android.gms:play-services-games:7.8.0'

Android Permission: App crashes needing bluetooth permission

I was recently creating an app that uses bluetooth. The problem is my app crashes when ever I start the bluetooth service. Here's my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.petalappstudio.fit" >
<uses-permission android:name="ANDROID.PERMISSION.BLUETOOTH"/>
<uses-permission android:name="ANDROID.PERMISSION.BLUETOOTH_ADMIN"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".bluetoothManager"
android:enabled="true"
android:exported="true">
</service>
</application>
Now as you can see I have added permission for bluetooth and bluetooth admin.
How ever my app crashes and in LOGCAT the error is
"java.lang.RuntimeException: Unable to start service " and is caused by
"java.lang.SecurityException: Need BLUETOOTH ADMIN permission: Neither user 10145 nor current process has android.permission.BLUETOOTH_ADMIN."
But I have added permission as you can see. Now why is this happening ?
Try to add one more permission :
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Refe. : Android Permission BLUETOOTH Manifest error
Note : also check device support Bluetooth feature or not using :
<uses-feature android:name="android.hardware.bluetooth" android:required="true" />

java.lang.SecurityException: Permission Denial: starting Intent

I am a newbie to Android application development... When i try to run my application i am getting a security exception as Permission Denial... though i am able to open my application i am unable to proceed to any of the process... Application doesn't access the web service... Plz help me out...
The following is the exception message I receive,
[2012-01-11 11:02:09 - eCalc] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.anb.eCalculator/.LoginActivity } from null (pid=-1, uid=-1) requires android.permission.INTERNET
enter code here
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.anb.eCalculator"
android:installLocation="internalOnly"
android:versionName="1.2.1" android:versionCode="10">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:label="#string/app_name"
android:theme="#android:style/Theme"
android:permission="android.permission.INTERNET"
android:icon="#drawable/ecalcicon" android:allowClearUserData="true">
<activity android:name=".LoginActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".CalculationActivity"></activity>
<activity android:name="ResultActivity"></activity>
<activity android:name=".InformationActivity"></activity>
<activity android:name=".RegisterActivity"></activity>
<activity android:name=".SettingsActivity"></activity>
<activity android:name=".ResultDetailsActivity"></activity>
<activity android:name=".Disclaimer"></activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:targetSdkVersion="5"
android:minSdkVersion="5"
android:maxSdkVersion="12">
</uses-sdk>
<uses-permission android:name="android.permission.INTERNET" />
Add this above line in your manifest file after your <uses-sdk> line.
Add this permission to your manifest file.
<uses-permission android:name="android.permission.INTERNET" />
I fixed it .
Click on "Run" and "Edit configuration". Select the activity you want to launch.

Categories

Resources