Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to forbid Tablet usage in expo / react-native?

I have developed an app with Expo and react-native for Smartphones - now I am trying to upload the ".aab" file to the Google Play Store - however it seems like it will be available for tablet and wearables, too. I could not really find out how to either code it into the "app.json" or into the code itself, that only a smartphone must be supported.

Furthermore, it should not be possible to even download the app from any other device than a smartphone, cause that would cause bad ux

I tried the device catalogue but could only choose to block by processor or RAM - is there an easy goto solution?

like image 880
Kev1n91 Avatar asked Apr 29 '20 12:04

Kev1n91


People also ask

What is slug in Expo?

Slug. We use the word "slug" in app. json to refer to the name to use for your app in its url. For example, the Native Component List app lives at https://expo.dev/@community/native-component-list and the slug is native-component-list.

Is React Native faster than Expo?

Native modules always will be faster than JS code and it is true at the time of writing this for React Native. If you want to write you own native module and integrate it with your React Native application then you can do it easily with React Native CLI but if you are using expo then you will have a hard time doing so.

Is it better to use Expo or React Native?

If you have a project requiring rapid development and have chosen React Native to build cross-platform applications, then Expo is for you.

Is Expo good for React Native?

Here are some good reasons to use Expo to build your React Native app. If you are given a project that needs rapid development, and you have picked React Native to build the cross-platform app, Expo is the best fit for you. With Expo, you can build and deploy React Native apps for both iOS and Android with ease.


Video Answer


1 Answers

To forbid your app from Tablet/TV support you just need to add the following tag to AndroidManifestFile.xml.

If you're using expo try to eject and do it.

<manifest ... >
    <supports-screens android:smallScreens="true"
                      android:normalScreens="true"       
                      android:largeScreens="false"         <- forbid for tablets
                      android:xlargeScreens="false"/>      <- forbid for tv
    ...
</manifest>

Note: The below things said by the expo so don't worry about eject(If you do not want to modify native files) but know about completely.

After you eject, all your JS files will stay the same, but we'll additionally create ios and android directories in your project folder. These will contain Xcode and Android Studio projects respectively, and they'll have dependencies on React Native and on Expo's core SDK. You'll still be able to develop and test your project with Expo CLI, and you'll still be able to publish your Expo JS code the same way. However, if you add native dependencies that aren't included in Expo, other users won't be able to run those features of your app with the main Expo app. You'll need to distribute the native project yourself.

like image 58
Mohamed Jakkariya Avatar answered Oct 08 '22 05:10

Mohamed Jakkariya