AreusAstarte
AreusAstarte

Reputation: 1998

Different App versions in one APK

This is my problem: I have an application that requires a certain persmission (Write-SMS) that will of course only function on phones. Now, the app requires that permission for a feature that will be disabled on tablet versions but it won't let users install the app on tablets.

I guess my question is this:

  1. Can I easily create a second manifest for the tablet version, that will be roughly the same as the phone version but without the persmission?

  2. If I'm doing so, is there a way to check what manifest version is being used? I might want to add features to the tablet version that are tablet exclusive and vice versa.

All of course preferibly in one apk, that gets exported and signed once. Thanks for your help in advance!

Upvotes: 1

Views: 93

Answers (2)

Divyansh Goenka
Divyansh Goenka

Reputation: 1094

I think you must check it in the actual method itself, because permissions can be optional or compulsory, but that's it, not distinguishable for different devices..

Upvotes: 0

Raghav Sood
Raghav Sood

Reputation: 82533

Simple add:

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

To your manifest. The SMS permission automatically asks for a Telephony feature. Adding this tells android that even though you ask for this feature, you don't need it.

Be sure to add an if-else check to see if you can sens SMS from the device before doing so.

Upvotes: 3

Related Questions