android - 如果有调用权限,如何使应用程序与平板电脑兼容?

标签 android screen compatibility tablet

我最近发布了一个用于生产的应用程序,我使用的是 API 级别 19,因此它应该可以在任何 Android 高于 4.4 的手机上运行,​​确实如此。人们可以毫无问题地将它安装在手机上。突然间,平板电脑用户开始提示,当他们在 Google Play 上时,显示“此应用与您的设备不兼容”,因此他们无法安装。其中一款在平板电脑上安装了 Android 6,因此从理论上讲,它应该可以毫无问题地运行。然而,另一个人说他们在 Android 7.1.1 平板电脑上安装它没有问题。

感谢@tyczj 的评论,并在询问了一些使用平板电脑的人后,我意识到兼容性问题之一是该应用程序需要通话权限,这并非在所有平板电脑上都可用。因此,我想知道是否有任何方法可以让没有 SIM 卡的平板电脑可以使用它,但具有相同的权限,可以使其在手机上完全发挥作用。对于没有SIM卡/通话功能的平板电脑,有没有办法为这些权限添加异常(exception)?

下面我从 list 中提取了部分:

<< ? xml version = "1.0"
encoding = "utf-8" ? >
  <
  manifest xmlns : android = "http://schemas.android.com/apk/res/android"
package = "packagename" >

  <
  uses - permission android: name = "android.permission.INTERNET" / >
  <
  uses - permission android: name = "android.permission.CALL_PHONE" / >
  <
  uses - permission android: name = "android.permission.VIBRATE" / >
  <
  uses - permission android: name = "android.permission.WRITE_EXTERNAL_STORAGE" / >
  <
  uses - permission android: name = "android.permission.CAMERA" / >
  <
  uses - permission android: name = "android.permission.ACCESS_FINE_LOCATION" / >
  <
  uses - permission android: name = "android.permission.ACCESS_COARSE_LOCATION" / >
  <
  uses - permission android: name = "android.permission.ACCESS_NETWORK_STATE" / >


  <
  application
android: allowBackup = "true"
android: icon = "@mipmap/app_logo"
android: label = "@string/app_name"
android: roundIcon = "@mipmap/app_logo"
android: supportsRtl = "true"
android: theme = "@style/AppTheme" >
  <
  activity android: name = ".MainScreenActivity" >
  <
  intent - filter >
  <
  action android: name = "android.intent.action.MAIN" / >

  <
  category android: name = "android.intent.category.LAUNCHER" / >
  <
  /intent-filter> <
  /activity> <
  activity android: name = ".MainMenu" / >

//And some other activities below

还有 Gradle:

pply plugin: 'com.android.application'



android {
  compileSdkVersion 26
  defaultConfig {
    generatedDensities = []
    applicationId "package_name"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 30 
    versionName "30"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true


  }
  aaptOptions {

  }
  buildTypes {
    release {
      minifyEnabled false
      crunchPngs false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
  //Here are the dependencies

最佳答案

需要另外声明uses-feature为了您的许可。在此声明中,您可以指定特定权限是否是您的应用运行所必需的。

<uses-feature
  android:name="string"
  android:required=["true" | "false"]
  android:glEsVersion="integer" />

这里的 name 是权限描述符,required 是确定该权限/功能是否是您的应用运行所必需的标志。

尝试将此添加到您的 AndroidManifest.xml 文件中:

<uses-feature
    android:name="android.hardware.telephony"
    android:required="false" />

关于android - 如果有调用权限,如何使应用程序与平板电脑兼容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48343171/

相关文章:

java - android版本和解析错误

android - 使用 react-native-video (Android) 在加载和视频播放之间 react 原生黑屏一秒钟

java - 在使用 php 和 android 上传到服务器之前调整图像大小

android - 解析多个 JSON 字符串

iphone - 如何制作 iPhone 应用程序并排除 iPhone 5?

python-3.x - Python 3.2 和 Qt 之间不兼容?

python - 嵌套参数未编译

jquery - 根据用户屏幕尺寸设置div宽度

prolog - 不同 clp(FD) 库实现的兼容性