Andhravaala
Andhravaala

Reputation: 319

How to make Multiple APKs based on uses-features "android.hardware.telephony" in Android?

I want to use Multiple APK support in Android to create 2 different 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.

Upvotes: 1

Views: 3050

Answers (1)

Marco Di Scala
Marco Di Scala

Reputation: 484

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()

Upvotes: 4

Related Questions