Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android.permission.CALL_PHONE: making single apk for phones and tablets:

Tags:

android

I want my app to be available for both phones and tablets. The only difference between phone and tablet versions is: in "phone" version my app has buttons, which allow to make a phone call to a certain number. What is my problem: to be able to make phone call I need to add a permission to manifest file -

<uses-permission android:name="android.permission.CALL_PHONE" />

This permission makes application incompatible with tablets. If I remove the permission, app cant make calls being launched on phone. How to make an app, that supports both phones and tablets and allows to make calls from phones?

like image 791
Eugene Chumak Avatar asked Jan 17 '23 06:01

Eugene Chumak


2 Answers

A single app on the Play Store can have multiple apks, a lot of apps use this to customize the experience. If you ever see Android version mentioned as varies on Play store page, then you know they are following this approach.

You can remove this permission in the 2nd project and remove the code related to phone call. Depending on the type of device, Play Store will show the corresponding apk (ie Phone permission apk for phones and the 2nd one for tablets)

Alternatively

In the Android Manifest file use

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

and in your code

boolean hasTelephony = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);

I have taken this info from Supporting android devices with phone and without phone capabilities

like image 189
Shikhar Shrivastav Avatar answered Jan 24 '23 02:01

Shikhar Shrivastav


Please refer this question, android.permission.CALL_PHONE for tablets, Phone apps usually work with tablets, if you face problem consider releasing two different version of application one for phone and another for tablet.

like image 33
Raghav Avatar answered Jan 24 '23 04:01

Raghav