Where is the App permission for "identity" in android marshmallow - android

I am trying to use an emulator with which comes with Android Studio, to see what permissions a user can enable / disable from this device.
While a developer can declare he needs access to "Identity" or contact card, it seems that in the emulator, there is no option to display the apps that have disabled access to "identity".
Does this mean that there is no option for a user to refuse access to identity ? Or is it just that it does not appear in the emulator unless you create an app that requests identity ?

If you are using an API 23 emulator, the grouping of Android permissions has changed for the new runtime permissions model. The full list of dangerous permissions and their associated groups can be found on this table.
You'll note that most of the permissions in the old Identity bucket have either been removed entirely or moved to the 'Contacts' group (as is the case for GET_ACCOUNTS).

Only "dangerous" permissions need to be requested from user in Android 6.0. Others are granted automatically when they are declared in the manifest.
List of dangerous permissions can be found here: http://developer.android.com/guide/topics/security/permissions.html#normal-dangerous - they are divided in groups, which are:
CALENDAR
READ_CALENDAR
WRITE_CALENDAR
CAMERA
CAMERA
CONTACTS
READ_CONTACTS
WRITE_CONTACTS
GET_ACCOUNTS
LOCATION
ACCESS_FINE_LOCATION
ACCESS_COARSE_LOCATION
MICROPHONE
RECORD_AUDIO
PHONE
READ_PHONE_STATE
CALL_PHONE
READ_CALL_LOG
WRITE_CALL_LOG
ADD_VOICEMAIL
USE_SIP
PROCESS_OUTGOING_CALLS
SENSORS
BODY_SENSORS
SMS
SEND_SMS
RECEIVE_SMS
READ_SMS
RECEIVE_WAP_PUSH
RECEIVE_MMS
STORAGE
READ_EXTERNAL_STORAGE
WRITE_EXTERNAL_STORAGE

Related

Why READ_PHONE_STATE permission asked "make and manage phone call"?

For getting the IMEI i using from this code:
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, 1);
} else {
iMEI = tm.getDeviceId();
}
But when my app is running this dialog box coming up:
The program asks to grant permission To make and manage phone calls which can scary users from using app.
And now my question is:
Why READ_PHONE_STATE permission asked "make and manage phone call"? While I have not make phone call and manage phone call in my
app.
READ_PHONE_STATE permission is listed as Dangerous permission and provides access to read phone state. It comes under the Phone permission group. If dangerous permission is asked, the system shows dialog related to its group. in your case, Phone. and That is the reason- the user is asked for "make and manage phone call" permission. This is how the permissions are asked-
https://developer.android.com/training/permissions/requesting
To make it more clear, see
https://developer.android.com/guide/topics/permissions/overview
It says -
If the device is running Android 6.0 (API level 23) and the app's
targetSdkVersion is 23 or higher, the following system behavior
applies when your app requests a dangerous permission:
If the app doesn't currently have any permissions in the permission group, the system shows the permission request dialog to the user
describing the permission group that the app wants access to. The
dialog doesn't describe the specific permission within that group.
For example, if an app requests the READ_CONTACTS permission, the
system dialog just says the app needs access to the device's
contacts. If the user grants approval, the system gives the app just
the permission it requested.
If the app has already been granted another dangerous permission in the same permission group, the system immediately grants the
permission without any interaction with the user. For example, if an
app had previously requested and been granted the READ_CONTACTS
permission, and it then requests WRITE_CONTACTS, the system
immediately grants that permission without showing the permissions
dialog to the user.
There are a lot of better ways to get a unique identifier. For example-
String android_id = Settings.Secure.getString(getApplicationContext().getContentResolver(),
Settings.Secure.ANDROID_ID);
Why READ_PHONE_STATE permission asked "make and manage phone call"?
While I have not make phone call and manage phone call in my app.
After Marshmallow we need to explicitly call the permissions which come under Dangerous permission.
READ_PHONE_STATE comes under Permission Group Called Phone
Because google got lazy. It is the same with READ_EXTERNAL_STORAGE

Why does RECEIVE_SMS and READ_SMS permission do not have different prompt boxes to ask for permission?

I have listed both the permissions of RECEIVE_SMS and READ_SMS in my app's Manifest file and both of them has different permission strings too.
to grant the respective permissions. However, I have noticed that on granting(by the user) any one of the permissions(READ_SMS or RECEIVE_SMS) we can perform both the tasks. My question is that if both of them performs different tasks:
1) READ_SMS: It allows the app to read all the SMS's(currently present) on the user's phone.
2) RECEIVE_SMS: It allows the app to listen to all the SMS's that are received on the user's phone while he/she is using the app.
Both of them shows the same dialog box on asking for permission and on rejecting one of the permission both the dialog boxes do not appear.
If both have the same permission granting scenario's then why are they separated in form of two permissions? If anyone of you could help me with understanding this, then it would be a great help to me.
According to Android documentation on Requesting Permissions:
Permission groups:
All dangerous Android system permissions belong to permission groups. If the device is running Android 6.0 (API level 23) and the app's targetSdkVersion is 23 or higher, the following system behavior applies when your app requests a dangerous permission:
If an app requests a dangerous permission listed in its manifest, and the app does not currently have any permissions in the permission group, the system shows a dialog box to the user describing the permission group that the app wants access to. The dialog box does not describe the specific permission within that group. For example, if an app requests the READ_CONTACTS permission, the system dialog box just says the app needs access to the device's contacts. If the user grants approval, the system gives the app just the permission it requested.
If an app requests a dangerous permission listed in its manifest, and the app already has another dangerous permission in the same permission group, the system immediately grants the permission without any interaction with the user. For example, if an app had previously requested and been granted the READ_CONTACTS permission, and it then requests WRITE_CONTACTS, the system immediately grants that permission.
Caution: Future versions of the Android SDK might move a particular permission from one group to another. Therefore, don't base your app's logic on the structure of these permission groups.
For example, if your app requests the READ_CONTACTS permission, then the WRITE_CONTACTS permission, you shouldn't assume that the system can automatically grant the WRITE_CONTACTS permission, even though it's in the same permission group as READ_CONTACTS as of Android 8.0 (API level 26).
All SMS related permissions comes under permission group SMS.
Here is the list of permissions under SMS permission group:
SEND_SMS
SEND_SMS
RECEIVE_SMS
READ_SMS
RECEIVE_WAP_PUSH
RECEIVE_MMS

Android requires user to enable permissions for my app that are already requested in manifest

The application I am developing uses Bluetooth and Storage permissions, therefore my AndroidManifest.xml contains the following.
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"></uses-permission>
<uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"></uses-permission>
However, when the app is installed, upon scanning for Bluetooth devices nothing is found until I manually switch on permission for Location in my device settings (Settings -> Apps -> [My App] -> Permissions). I have read somewhere that this permission is required for Android 6.0 (maybe 7.0) and above if you want to use the Bluetooth, but why is it not enabled upon installation with these permissions in the manifest file? Have I missed one out?
Location and Bluetooth are two different things.
You don't need to request permission to access Bluetooth as it is a normal permission, but you do need to request permission for Location as it is a dangerous permission.
You can find a list of all permissions that must be requested on runtime here.
From the official documentation.
System permissions are divided into two categories, normal and dangerous:
Normal permissions do not directly risk the user's privacy. If your app lists a normal permission in its manifest, the system grants the
permission automatically.
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.
And
If the device is running Android 5.1 or lower, or your app's target SDK is 22 or lower: If you list a dangerous permission in your
manifest, the user has to grant the permission when they install the
app; if they do not grant the permission, the system does not install
the app at all.
If the device is running Android 6.0 or higher, and your app's target SDK is 23 or higher: The app has to list the permissions in
the manifest, and it must request each dangerous permission it
needs while the app is running. The user can grant or deny each
permission, and the app can continue to run with limited
capabilities even if the user denies a permission request.
So, most likely you are testiong your app on device or emulator running API 23+ and have a request to location of the device.
Location permission is a dangerous one, so in Android 6.0 or higher user is forsed to allow location access manually. For this you have to add dangerous permissions programmatically. Take a look here for the good instruction for this.
P.S. To find out, which permissions are dangerous, and wich are normal, look here.
Certain permissions are classified as dangerous and they need to be asked for in runtime.
ActivityCompat.requestPermissions(thisActivity,
new String[]{Manifest.permission.READ_CONTACTS},
MY_PERMISSIONS_REQUEST_READ_CONTACTS);
Replace the READ_CONTACTS permission with location permission

android api 23 dialog alert permission does not appear

in my app i need the android internet permission.
I have insert the permission in the file AndroidManifest.xml (with others permissions)
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
the build.gradle defaul config have the correct api level:
defaultConfig {
applicationId "com.mytry"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
and the activity with the internet call is this:
public class ActivityLoginScreen extends Activity{
final int REQUEST_INTERNET = 1;
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
if (ContextCompat.checkSelfPermission(this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.INTERNET)) {
//permesso già richiesto in precedenza. Negato dall'utente
} else {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.INTERNET}, REQUEST_INTERNET);
}
}
}
#Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case REQUEST_INTERNET: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, "GRANTED", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "NO GRANTED", Toast.LENGTH_SHORT).show();
}
return;
}
}
}
But when i launch my app and go to the activity nothing appare.
If i go in the app settings emulator, i can see only 2 permissions.
Possible solution for this problem? Where i am in wrong?
I have use this type of request in other apps without problems
Thank you.
EDIT:
For all the comments type this:
"no necessary the request because: If an app declares that it needs a normal permission, the system automatically grants the permission to the app"
this is correct.
sorry for this stupid question.
I knew the matter of default permission but my appa did not work anyway because it gave error in Internet permission.
I created a new emulator and now seems to be going.
Not all permission need to be granted by user. According to Android Documentation
System permissions are divided into two categories, normal and dangerous:
Normal permissions do not directly risk the user's privacy. If your app lists a normal permission in its manifest, the system grants the permission automatically.
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.
You only need to check for permission if the permission is belong to dangerous permission category (Ex: Location, Storage, Camera etc)
Internet permission are granted by default.
It does not require user to grant it, so you already have internet permission just enable your internet.
Normal permissions cover areas where your app needs to access data or
resources outside the app's sandbox, but where there's very little
risk to the user's privacy or the operation of other apps. For
example, permission to set the time zone is a normal permission. If an
app declares that it needs a normal permission, the system
automatically grants the permission to the app. For a full listing of
the current normal permissions, see Normal permissions.
As of API level 23, the following permissions are classified as PROTECTION_NORMAL:
For these no dailog will shown to user system will automatically grant the permission.
ACCESS_LOCATION_EXTRA_COMMANDS
ACCESS_NETWORK_STATE
ACCESS_NOTIFICATION_POLICY
ACCESS_WIFI_STATE
BLUETOOTH
BLUETOOTH_ADMIN
BROADCAST_STICKY
CHANGE_NETWORK_STATE
CHANGE_WIFI_MULTICAST_STATE
CHANGE_WIFI_STATE
DISABLE_KEYGUARD
EXPAND_STATUS_BAR
GET_PACKAGE_SIZE
INSTALL_SHORTCUT
INTERNET
KILL_BACKGROUND_PROCESSES
MODIFY_AUDIO_SETTINGS
NFC
READ_SYNC_SETTINGS
READ_SYNC_STATS
RECEIVE_BOOT_COMPLETED
REORDER_TASKS
REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
REQUEST_INSTALL_PACKAGES
SET_ALARM
SET_TIME_ZONE
SET_WALLPAPER
SET_WALLPAPER_HINTS
TRANSMIT_IR
UNINSTALL_SHORTCUT
USE_FINGERPRINT
VIBRATE
WAKE_LOCK
WRITE_SYNC_SETTINGS
All dangerous Android system permissions belong to permission groups.
If the device is running Android 6.0 (API level 23)
PROTECTION_DANGEROUS permissions :
These permissions will show dialog to users.Sample Code
READ_CALENDAR
WRITE_CALENDAR
CAMERA
READ_CONTACTS
WRITE_CONTACTS
GET_ACCOUNTS
ACCESS_FINE_LOCATION
ACCESS_COARSE_LOCATION
RECORD_AUDIO
READ_PHONE_STATE
CALL_PHONE
READ_CALL_LOG
WRITE_CALL_LOG
ADD_VOICEMAIL
USE_SIP
PROCESS_OUTGOING_CALLS
BODY_SENSORS
SEND_SMS
RECEIVE_SMS
READ_SMS
RECEIVE_WAP_PUSH
RECEIVE_MMS
READ_EXTERNAL_STORAGE
WRITE_EXTERNAL_STORAGE

How to ask for android.permission.CALL_PHONE but still install on tablet? [duplicate]

This question already has an answer here:
Optional permissions so an app can show on all devices and enable optional features on some?
(1 answer)
Closed 7 years ago.
I have an app I just published to the Play Store, that's showing up as "This app is incompatible with all of your devices" when I try to access it from tablets that lack telephony. It installs just fine on actual Android phones.
Here's the thing - we want users to be able to install the app on tablets and other devices that don't have phones, and to simply have the telephone functions not work. But if I include the CALL_PHONE permission in the manifest, the Play Store simply won't allow it to be installed.
<uses-permission android:name="android.permission.CALL_PHONE" />
How do I get Google Play to allow an app that asks for the CALL_PHONE permission to install on a device that doesn't have a phone?
You can specify that Telephony is optional:
<uses-feature android:name="android.hardware.telephony" android:required="false"/>
The documentation says:
The table below lists permissions that imply feature requirements
equivalent to those declared in elements. Note that
declarations, including any declared android:required
attribute, always take precedence over features implied by the
permissions below.
For any of the permissions below, you can disable filtering based on
the implied feature by explicitly declaring the implied feature
explicitly, in a element, with an
android:required="false" attribute. For example, to disable any
filtering based on the CAMERA permission, you would add this
declaration to the manifest file:
<uses-feature android:name="android.hardware.camera" android:required="false" />
In your case, the relevant portion of the table is:
Cateegory This permission... Implies This Feature Requirement
Telephony CALL_PHONE android.hardware.telephony
CALL_PRIVILEGED android.hardware.telephony
MODIFY_PHONE_STATE android.hardware.telephony
PROCESS_OUTGOING_CALLS android.hardware.telephony
READ_SMS android.hardware.telephony
RECEIVE_SMS android.hardware.telephony
RECEIVE_MMS android.hardware.telephony
RECEIVE_WAP_PUSH android.hardware.telephony
SEND_SMS android.hardware.telephony
WRITE_APN_SETTINGS android.hardware.telephony
WRITE_SMS android.hardware.telephony

Categories

Resources