Search code examples
androidscreencompatibilitytablet

How to make app compatible with tablet, if there is call permission?


I have recently released an app for production and I have used API Level 19, so it should work on any phones that have Android higher than 4.4, which it does. People could install it on their phones with no problem. Suddenly, people with tablets started complaining that when they are on Google Play, it shows "This app is not compatible with your device", so they can't install it. One of them has Android 6 on the tablet so, in theory, it should work without any problem. Another person, however, said that they have no problem installing it on an Android 7.1.1 tablet.

Thanks to the comments from @tyczj and after asking some people with tablets, I have realized that one of the problems in compatibility is the fact that the app needs permission for call, which is not available in all the tablets. Therefore I would like to know if there is any way I could make it available to tablets without SIM cards, but with the same permissions which would make it fully functional on phones. Is there any way to add exceptions to these permissions for tablets without SIM cards/call functions?

Below I have extracted the part from Manifest:

<< ? 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

And the 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


Solution

  • You need to additionally declare uses-feature for your permission. Inside this declaration you can specify if a particular permission is mandatory for your app to work.

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

    Here name is the permission descriptor and required is the flag that determines whether that permission/feature is mandatory for your app to work.

    Try adding this to your AndroidManifest.xml file:

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