可以用 Api 23 (6.0) 编译并保持旧的权限系统(安装时)吗?
It is possible to compile with Api 23 (6.0) and to maintain the old permission system (install-time)?
我在官方 android 博客上看到了这个:
Permission Changes With Marshmallow, permissions have moved from
install-time to runtime. This is a mandatory change for SDK 23+,
meaning it will affect all developers and all applications targeting
Android 6.0.
所以...如果您使用 Android 6.0 (api 23) 编译但您的目标是 Android 4.4 (api 20)?
我的意思是这样做:
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 20
}
我的项目现在的要求是维护旧的权限系统和目标 sdk 版本 20(因为我需要维护旧的通知系统,如果你的目标 sdk 版本高于 20,你必须使用新的通知系统)。那么...如果我以 sdk 版本 20 为目标,我可以使用 Api 23 编译并维护旧的权限系统吗?
是的,如果 targetSdkVersion
设置 <23,将使用旧的权限系统(即使在 Android 6.0 上)。但是,Android 6.0 上的用户稍后可以从 设置 中手动禁用个人权限。虽然 Android 6.0 会在用户尝试这样做时发出警告,但他们仍然可以撤销。
现在的问题是用户撤销权限后您的应用程序会崩溃吗?
When we call a function that requires a permission user revoked on
application with targetSdkVersion
less than 23, no Exception will
be thrown. Instead it will just simply do nothing. For the function
that return value, it will return either null or 0 depends on the
case. Although application would not be crashed from calling a
function. It may still can crash from what that application does next
with those returned value.
我在官方 android 博客上看到了这个:
Permission Changes With Marshmallow, permissions have moved from install-time to runtime. This is a mandatory change for SDK 23+, meaning it will affect all developers and all applications targeting Android 6.0.
所以...如果您使用 Android 6.0 (api 23) 编译但您的目标是 Android 4.4 (api 20)?
我的意思是这样做:
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 20
}
我的项目现在的要求是维护旧的权限系统和目标 sdk 版本 20(因为我需要维护旧的通知系统,如果你的目标 sdk 版本高于 20,你必须使用新的通知系统)。那么...如果我以 sdk 版本 20 为目标,我可以使用 Api 23 编译并维护旧的权限系统吗?
是的,如果 targetSdkVersion
设置 <23,将使用旧的权限系统(即使在 Android 6.0 上)。但是,Android 6.0 上的用户稍后可以从 设置 中手动禁用个人权限。虽然 Android 6.0 会在用户尝试这样做时发出警告,但他们仍然可以撤销。
现在的问题是用户撤销权限后您的应用程序会崩溃吗?
When we call a function that requires a permission user revoked on application with
targetSdkVersion
less than 23, no Exception will be thrown. Instead it will just simply do nothing. For the function that return value, it will return either null or 0 depends on the case. Although application would not be crashed from calling a function. It may still can crash from what that application does next with those returned value.