1

I want to use Multiple APK support in Android to create 2 different APKs.

  • One APK for devices which supports "PHONE CALL & SMS".

  • Another APK for devices which doesn't support "PHONE CALL & SMS".

    Rest of the features are common in both the APKs.

I've achieved the first APK when I keep required feature & permissions in Manifest.xml.

<uses-feature android:name="android.hardware.telephony" android:required="true"/>
<uses-permission android:name="android.permission.SEND_SMS"/>

I tried to create another APK for devices which should not have "PHONE CALL & SMS" feature with the following Manifest changes.

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

But, I did't succeed. Could anyone please let me know how to achieve this.

Thanks in advance.

Community
  • 1
  • 1
Andhravaala
  • 319
  • 6
  • 18

1 Answers1

4

There is no need to create multiple APK.

If you use:

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

Your apk will be available for devices that support this feature and for device that does not support it. Just simply in your code check if the instance of the telephony adapter is null or not:

hasSystemFeature(PackageManager.FEATURE_TELEPHONY)

or

getPhoneType()
Marco Di Scala
  • 424
  • 1
  • 7
  • 18
  • 1
    Yes, with or without this feature the result is same. But, when I gave "", all the devices which doesn't have telephony feature got stripped out. I need this permission to send SMS and same cannot be enforced at runtime. So, I need to handle it somehow in manifest itself. – Andhravaala Oct 11 '14 at 01:59
  • `` should not force telephony since it's simply a string that must match in case you use the telephony feature. Anyway I think you can add permissions by code with PackageManager programmatically. – Marco Di Scala Oct 11 '14 at 11:32