I'm trying to ask an authorization for devices with API >= 23 to check package user stats.
As stated in https://developer.android.com/about/versions/android-5.0.html#System, I can use the android.app.usage API.
The usage of that API requires that I declare in the manifest this permission:
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions" />
But if I don't "ignore ProtectedPermissions", AndroidStudio gives me this error:
The questions:
does this mean that, how stated in the documentation, The user must also enable access for this app through Settings > Security > Apps with usage access., or the two things are not related to eachothers?
How do I ask to the user to enable access for this app through Settings > Security > Apps with usage access. anyway?
And anyway, why, when I manually set to on the app in Settings > Security > Apps, bypassing the previous point, I still don't get the dialog when I reach this lines of code, the authorization still is not given? This is exactly what the Android Documentation seems to ask to do. Why this request doesn't even popup? What else is missing?
if (Build.VERSION.SDK_INT >= 23)
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.PACKAGE_USAGE_STATS) != PackageManager.PERMISSION_GRANTED)
ActivityCompat.requestPermissions(myActivity, new String[]{Manifest.permission.PACKAGE_USAGE_STATS}, MY_REQUEST_CODE); // <-- I reach this point but the dialog does not popup!??
You should set permission like that;
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
And you can access permission as below;
Intent intent = new
Intent(android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS);
startActivity(intent);
Hope, it helps.
Related
I started targeting Android 13 with API 33. The app is requesting Manifest.permission.READ_EXTERNAL_STORAGE for the older APIs. Now I know that I have to request the new permissions: READ_MEDIA_IMAGES and READ_MEDIA_VIDEO.
I have added in the manifest:
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
and now, as a result, in the setting of the permissions for the app I see an extra option to enable these permissions.
What I can't do is to ask the permission at runtime
If I try to access Manifest.permission.READ_MEDIA_IMAGES in the code I get unresolved reference so I can't dynamically request the permission and if I don't then the user needs to do it manually.
How to handle the READ_MEDIA_IMAGES and READ_MEDIA_VIDEO?
According to official documentation https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions, you should ask permission in runtime.
Also notice:
Note: If your app only needs to access images, photos, and videos, consider using the photo picker instead of declaring the READ_MEDIA_IMAGES and READ_MEDIA_VIDEO permissions.
In manifest not added android.permission.READ_PHONE_STATE. permission.
Why error comes when I upload a new apk version error comes below.
Your app has an apk with version code 1 that requests the following permission(s): android.permission.READ_PHONE_STATE. Apps using these permissions in an APK are required to have a privacy policy set.
I have attached a screenshot of my google play store account.
my manifest file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.package.name">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".utils.PreferenceManager"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".SplashScreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:screenOrientation="portrait" />
<activity
android:name=".CategoryListActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ImagesActivity"
android:screenOrientation="portrait" />
</application>
</manifest>
Your app's manifest.xml having these permission to access information from your's device but you don't have privacy policy link while submitting on the play store. so you getting this warning.
Need privacy policy for the app If your app handles personal or sensitive user data
Adding a privacy policy to your app's store listing helps provide transparency about how you treat sensitive user and device data.
Update 1
The privacy policy setting in Google Play Console has changed locations.
In Google Play Console,
Select Store presence → App content.
Under Privacy Policy.
Update 2
Select Policy → App content at the far bottom left.
Under Privacy Policy.
Just try to add this line to your manifest file:
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
and add attribute xmlns:tools="http://schemas.android.com/tools" to your <manifest> tag to define namespace tools
From the documentation for tools:node="remove":
Remove this element from the merged manifest. Although it seems like you should instead just delete this element, using this is necessary when you discover an element in your merged manifest that you don't need, and it was provided by a lower-priority manifest file that's out of your control (such as an imported library).
It's third party library. You can find the culprit in build/outputs/logs/manifest-merger-release-report.txt
The dependencies you have in your project, will add their own permissions.
Please do the below to find from where "READ_PHONE_STATE" is coming.
Rebuild your android application
Press "Ctrl+Shift+F" in android studio (basically do a search all in the editor of your preference).
Search for "READ_PHONE_STATE", you would find the entry in a regenerated manifest file (not the one you originally created). By the path of it you can know, from which dependency the permission is getting added.
It may be because of any third party lib which may include that permission so from my experience in this field You have to add the privacy policy regarding to that particular information it means if you ask get accounts permission in your app than you have to declare that with your privacy policy file we use that data i.e. email address or whatever with reasons like to login in google play game.
Also can do this
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
Hope This Will Guide you What You can do for this warning create privacy policy for your app and attach that with store listing.
you need to specify the min and target sdk version in the manifest file.
If not the android.permission.READ_PHONE_STATE will be added automaticly while exporting your apk file.
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="19" />
If you use React Native
This problem has been completely solved here
https://facebook.github.io/react-native/docs/removing-default-permissions
It can be that you need to add or update your privacy policy.
You can easily create a privacy policy using this template
https://app-privacy-policy-generator.firebaseapp.com/
Currently some people are facing the same issue because of using 12.0.0 version of AdMob lib.
Update it to 12.0.1. This should fix it. You can read more here
You need to provide a privacy policy for your app in the Google Play Console, or remove the permissions which require a privacy policy.
Go here: https://play.google.com/console/app/app-content/summary
Or open the Google Play Console for your app, scroll all the way to the bottom of the nav menu on the left and under the heading "Policy" click "App Content".
For more information on when and why the privacy policy is required, see the docs here.
If you're testing your app on a device > android 6.0 you have also to explicitely ask the user to grant the permission.
As you can see here READ_PHONE_STATE have a dangerous level.
If a permission have a dangerous level then the user have to accept or not this permission manually. You don't have the choice, you MUST do this
To do this from your activity execute the following code :
if the user use Android M and didn't grant the permission yet it will ask for it.
public static final int READ_PHONE_STATE_PERMISSION = 100;
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && checkSelfPermission(Manifest.permission.READ_PHONE_STATE)
!= PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE}, READ_PHONE_STATE_PERMISSION);
}
then override onRequestPermissionsResult in your activity
#Override
public void onRequestPermissionsResult(int requestCode, #NonNull String[] permissions, #NonNull int[] grantResults) {
switch (requestCode){
case READ_PHONE_STATE_PERMISSION: {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED){
//Permission granted do what you want from this point
}else {
//Permission denied, manage this usecase
}
}
}
}
You should read this article to know more about it
Probably you're using PlayServices of version 9.6.0. Then you should update it, it's library's bug. More info here.
OR
Add
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:node="remove" />
to your manifest file.
Are you using AdSense or other ads in your app, or maybe Google Analytics ? I think if you do so, even if you don't have the android.permission.READ_PHONE_STATE in your manifest this is added by the ads library.
There are free templates that might help you create a privacy policy.
This is the email i received from Google about it :
Hello Google Play Developer, Our records show that your app, xxx, with
package name xxx, currently violates our User Data policy regarding
Personal and Sensitive Information. Policy issue: Google Play requires
developers to provide a valid privacy policy when the app requests or
handles sensitive user or device information. Your app requests
sensitive permissions (e.g. camera, microphone, accounts, contacts, or
phone) or user data, but does not include a valid privacy policy.
Action required: Include a link to a valid privacy policy on your
app's Store Listing page and within your app. You can find more
information in our help center. Alternatively, you may opt-out of this
requirement by removing any requests for sensitive permissions or user
data. If you have additional apps in your catalog, please make sure
they are compliant with our Prominent Disclosure requirements. Please
resolve this issue by March 15, 2017, or administrative action will be
taken to limit the visibility of your app, up to and including removal
from the Play Store. Thanks for helping us provide a clear and
transparent experience for Google Play users. Regards, The Google Play
Team
You should drop android.permission.READ_PHONE_STATE permission. Add this to your manifest file:
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:node="remove" />
1.You need to create privacy policy page on your website and update your privacy policy for the permissions you are asking.
2.Update new SDK remove unwanted permissions and resubmit the app.
I found this free website that will make for you the policy AND host it:
https://www.freeprivacypolicy.com/
Then add it to the play store under Store Listing - at the bottom add the public link for the policy that you got from https://www.freeprivacypolicy.com/
I solved this problem by this way:
Google play console
find App content-> Privacy policy
and then
Privacy policy URL set to
you can submit your page.
2018 update:
For AdMob users, this causes AdMob version 12.0.0 (currently last version). It wrongly requests READ_PHONE_STATE permission, so even if your app doesn't require READ_PHONE_STATE permission in manifest, you won't be able to update your app in the Google Play Console (it will tell you to create a privacy policy page for your app, because your app requires this permission).
See this: https://developers.google.com/android/guides/releases#march_20_2018_-_version_1200
Also, they wrote they will publish an update to 12.0.1 fixing this soon.
I was facing same issue and got the error while uploading apk to Google play.
I used ads in my app, and I was not even mentioned READ_PHONE_STATE permission in my manifest file. but yet I got this error. Then I change dependencies for ads in build.gradle file. and then it solved my issue. They solved this issue in 12.0.1.
compile 'com.google.android.gms:play-services-ads:12.0.1'
See steb by step and you will understood
public static String getVideoTitle(String youtubeVideoUrl) {
Log.e(youtubeVideoUrl.toString() + " In GetVideoTitle Menu".toString() ,"hiii" );
try {
if (youtubeVideoUrl != null) {
URL embededURL = new URL("https://www.youtube.com/oembed?url=" +
youtubeVideoUrl + "&format=json"
);
Log.e(youtubeVideoUrl.toString() + " In EmbedJson Try Function ".toString() ,"hiii" );
Log.e(embededURL.toString() + " In EmbedJson Retrn value ".toString() ,"hiii" );
Log.e(new JSONObject(IOUtils.toString(embededURL)).getString("provider_name").toString() + " In EmbedJson Retrn value ".toString() ,"hiii" );
return new JSONObject(IOUtils.toString(embededURL)).getString("provider_name").toString();
}
} catch (Exception e) {
Log.e(" In catch Function ".toString() ,"hiii" );
e.printStackTrace();
}
return null;
}
If you are using the package device_id to get the unique device id then that will add an android.permission.READ_PHONE_STATE without your knowledge which eventually will lead to the Play Store warning.
Instead you can use the device_info package for the same purpose without the need of the extra permission. Check this SO thread
I could not release my app on Google as error show after uploading app apk file on Google testing "internal testing release."
Attached screen shot please resolve advise how to resolve this error.
App generated on Mobiroller app generator.
Even though after I have [Error massage seen: "Your APK or Android App Bundle is using permissions that require a privacy policy: (android.permission.CAMERA)."
1added privacy policy in Mobiroller in my app.
Error massage seen: "Your APK or Android App Bundle is using permissions that require a privacy policy: (android.permission.CAMERA)."
In Android 0, apps that want the capability of installing apk's must be specifically granted that permission by the user in the system settings. However, I havent been able to figure out how to get my app into the list of apps the user can pick from.
Can anyone point me in the right direction?
Thanks
Probably this blog post will help:
https://android-developers.googleblog.com/2017/08/making-it-safer-to-get-apps-on-android-o.html
To sum it up:
Need to declare the permission in your manifest <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
Before install you should check if the permission is still granted (PackageManager.canRequestPackageInstalls()), if not you can request it again using
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES);
intent.setData(Uri.parse("package:YOURPACKAGENAME"));
In manifest not added android.permission.READ_PHONE_STATE. permission.
Why error comes when I upload a new apk version error comes below.
Your app has an apk with version code 1 that requests the following permission(s): android.permission.READ_PHONE_STATE. Apps using these permissions in an APK are required to have a privacy policy set.
I have attached a screenshot of my google play store account.
my manifest file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.package.name">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".utils.PreferenceManager"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".SplashScreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:screenOrientation="portrait" />
<activity
android:name=".CategoryListActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ImagesActivity"
android:screenOrientation="portrait" />
</application>
</manifest>
Your app's manifest.xml having these permission to access information from your's device but you don't have privacy policy link while submitting on the play store. so you getting this warning.
Need privacy policy for the app If your app handles personal or sensitive user data
Adding a privacy policy to your app's store listing helps provide transparency about how you treat sensitive user and device data.
Update 1
The privacy policy setting in Google Play Console has changed locations.
In Google Play Console,
Select Store presence → App content.
Under Privacy Policy.
Update 2
Select Policy → App content at the far bottom left.
Under Privacy Policy.
Just try to add this line to your manifest file:
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
and add attribute xmlns:tools="http://schemas.android.com/tools" to your <manifest> tag to define namespace tools
From the documentation for tools:node="remove":
Remove this element from the merged manifest. Although it seems like you should instead just delete this element, using this is necessary when you discover an element in your merged manifest that you don't need, and it was provided by a lower-priority manifest file that's out of your control (such as an imported library).
It's third party library. You can find the culprit in build/outputs/logs/manifest-merger-release-report.txt
The dependencies you have in your project, will add their own permissions.
Please do the below to find from where "READ_PHONE_STATE" is coming.
Rebuild your android application
Press "Ctrl+Shift+F" in android studio (basically do a search all in the editor of your preference).
Search for "READ_PHONE_STATE", you would find the entry in a regenerated manifest file (not the one you originally created). By the path of it you can know, from which dependency the permission is getting added.
It may be because of any third party lib which may include that permission so from my experience in this field You have to add the privacy policy regarding to that particular information it means if you ask get accounts permission in your app than you have to declare that with your privacy policy file we use that data i.e. email address or whatever with reasons like to login in google play game.
Also can do this
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
Hope This Will Guide you What You can do for this warning create privacy policy for your app and attach that with store listing.
you need to specify the min and target sdk version in the manifest file.
If not the android.permission.READ_PHONE_STATE will be added automaticly while exporting your apk file.
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="19" />
If you use React Native
This problem has been completely solved here
https://facebook.github.io/react-native/docs/removing-default-permissions
It can be that you need to add or update your privacy policy.
You can easily create a privacy policy using this template
https://app-privacy-policy-generator.firebaseapp.com/
Currently some people are facing the same issue because of using 12.0.0 version of AdMob lib.
Update it to 12.0.1. This should fix it. You can read more here
You need to provide a privacy policy for your app in the Google Play Console, or remove the permissions which require a privacy policy.
Go here: https://play.google.com/console/app/app-content/summary
Or open the Google Play Console for your app, scroll all the way to the bottom of the nav menu on the left and under the heading "Policy" click "App Content".
For more information on when and why the privacy policy is required, see the docs here.
If you're testing your app on a device > android 6.0 you have also to explicitely ask the user to grant the permission.
As you can see here READ_PHONE_STATE have a dangerous level.
If a permission have a dangerous level then the user have to accept or not this permission manually. You don't have the choice, you MUST do this
To do this from your activity execute the following code :
if the user use Android M and didn't grant the permission yet it will ask for it.
public static final int READ_PHONE_STATE_PERMISSION = 100;
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && checkSelfPermission(Manifest.permission.READ_PHONE_STATE)
!= PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE}, READ_PHONE_STATE_PERMISSION);
}
then override onRequestPermissionsResult in your activity
#Override
public void onRequestPermissionsResult(int requestCode, #NonNull String[] permissions, #NonNull int[] grantResults) {
switch (requestCode){
case READ_PHONE_STATE_PERMISSION: {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED){
//Permission granted do what you want from this point
}else {
//Permission denied, manage this usecase
}
}
}
}
You should read this article to know more about it
Probably you're using PlayServices of version 9.6.0. Then you should update it, it's library's bug. More info here.
OR
Add
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:node="remove" />
to your manifest file.
Are you using AdSense or other ads in your app, or maybe Google Analytics ? I think if you do so, even if you don't have the android.permission.READ_PHONE_STATE in your manifest this is added by the ads library.
There are free templates that might help you create a privacy policy.
This is the email i received from Google about it :
Hello Google Play Developer, Our records show that your app, xxx, with
package name xxx, currently violates our User Data policy regarding
Personal and Sensitive Information. Policy issue: Google Play requires
developers to provide a valid privacy policy when the app requests or
handles sensitive user or device information. Your app requests
sensitive permissions (e.g. camera, microphone, accounts, contacts, or
phone) or user data, but does not include a valid privacy policy.
Action required: Include a link to a valid privacy policy on your
app's Store Listing page and within your app. You can find more
information in our help center. Alternatively, you may opt-out of this
requirement by removing any requests for sensitive permissions or user
data. If you have additional apps in your catalog, please make sure
they are compliant with our Prominent Disclosure requirements. Please
resolve this issue by March 15, 2017, or administrative action will be
taken to limit the visibility of your app, up to and including removal
from the Play Store. Thanks for helping us provide a clear and
transparent experience for Google Play users. Regards, The Google Play
Team
You should drop android.permission.READ_PHONE_STATE permission. Add this to your manifest file:
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:node="remove" />
1.You need to create privacy policy page on your website and update your privacy policy for the permissions you are asking.
2.Update new SDK remove unwanted permissions and resubmit the app.
I found this free website that will make for you the policy AND host it:
https://www.freeprivacypolicy.com/
Then add it to the play store under Store Listing - at the bottom add the public link for the policy that you got from https://www.freeprivacypolicy.com/
I solved this problem by this way:
Google play console
find App content-> Privacy policy
and then
Privacy policy URL set to
you can submit your page.
2018 update:
For AdMob users, this causes AdMob version 12.0.0 (currently last version). It wrongly requests READ_PHONE_STATE permission, so even if your app doesn't require READ_PHONE_STATE permission in manifest, you won't be able to update your app in the Google Play Console (it will tell you to create a privacy policy page for your app, because your app requires this permission).
See this: https://developers.google.com/android/guides/releases#march_20_2018_-_version_1200
Also, they wrote they will publish an update to 12.0.1 fixing this soon.
I was facing same issue and got the error while uploading apk to Google play.
I used ads in my app, and I was not even mentioned READ_PHONE_STATE permission in my manifest file. but yet I got this error. Then I change dependencies for ads in build.gradle file. and then it solved my issue. They solved this issue in 12.0.1.
compile 'com.google.android.gms:play-services-ads:12.0.1'
See steb by step and you will understood
public static String getVideoTitle(String youtubeVideoUrl) {
Log.e(youtubeVideoUrl.toString() + " In GetVideoTitle Menu".toString() ,"hiii" );
try {
if (youtubeVideoUrl != null) {
URL embededURL = new URL("https://www.youtube.com/oembed?url=" +
youtubeVideoUrl + "&format=json"
);
Log.e(youtubeVideoUrl.toString() + " In EmbedJson Try Function ".toString() ,"hiii" );
Log.e(embededURL.toString() + " In EmbedJson Retrn value ".toString() ,"hiii" );
Log.e(new JSONObject(IOUtils.toString(embededURL)).getString("provider_name").toString() + " In EmbedJson Retrn value ".toString() ,"hiii" );
return new JSONObject(IOUtils.toString(embededURL)).getString("provider_name").toString();
}
} catch (Exception e) {
Log.e(" In catch Function ".toString() ,"hiii" );
e.printStackTrace();
}
return null;
}
If you are using the package device_id to get the unique device id then that will add an android.permission.READ_PHONE_STATE without your knowledge which eventually will lead to the Play Store warning.
Instead you can use the device_info package for the same purpose without the need of the extra permission. Check this SO thread
I could not release my app on Google as error show after uploading app apk file on Google testing "internal testing release."
Attached screen shot please resolve advise how to resolve this error.
App generated on Mobiroller app generator.
Even though after I have [Error massage seen: "Your APK or Android App Bundle is using permissions that require a privacy policy: (android.permission.CAMERA)."
1added privacy policy in Mobiroller in my app.
Error massage seen: "Your APK or Android App Bundle is using permissions that require a privacy policy: (android.permission.CAMERA)."
I am trying to implement the Google's Fingerprint API in my app (in my Fragment specifically). Google has given an example but it's implemented inside an Activity here.
My specific question is that the code below to check if there are enrolled fingerprints already, it is giving me an error (screenshot below):
Question --> What change do I need to do to make it work in my Fragment (as opposed to an activity like Google has)?
if (!mFingerprintManager.hasEnrolledFingerprints()) {
purchaseButton.setEnabled(false);
// This happens when no fingerprints are registered.
Toast.makeText(getActivity(),
"Go to 'Settings -> Security -> Fingerprint' and register at least one fingerprint",
Toast.LENGTH_LONG).show();
return;
}
Android 6.0 must 'ask' for permission at run time. https://developer.android.com/training/permissions/requesting.html
Dangerous permissions can give the app access to the user's
confidential data. If your app lists a normal permission in its
manifest, the system grants the permission automatically. If you list
a dangerous permission, the user has to explicitly give approval to
your app.
Even if you have <uses-permission android:name="android.permission.USE_FINGERPRINT"/> in your manifest, My understanding is that you must ask for the permission. So it looks like the error is because your app doesn't have -run time- permission to use the fingerprint manager.
(only like 90% sure of this, since I'm sticking with 5.0 for now, sorry)
Update: http://developer.android.com/reference/android/Manifest.permission.html#USE_FINGERPRINT
public static final String USE_FINGERPRINT ---------- Added in API level 23
Allows an app to use fingerprint hardware.
Protection level: normal
So it appears you shouldn't need this permission at run time.
1) Do you have the permission in your manifest?
2) You should put the following code in yours to check to see if permission is revoked/not given for some reason.
if (ContextCompat.checkSelfPermission(thisActivity,
Manifest.permission.USE_FINGERPRINT) // this might need massaged to 'android.permission.USE_FINGERPRINT'
!= PackageManager.PERMISSION_GRANTED) {
Log.d ("TEST", "You don't have permission");
}
(or something close to this) like the example from https://developer.android.com/training/permissions/requesting.html