A few days ago I was finally able to port Unstoppaball DX and Vertical Void DX to Android. Reception has been good so far, and I’m glad it worked out :)
Porting and putting the games onto the GooglePlay-store was relatively straightforward. At least until I encountered this:
That is an all-encompassing list of ALL Android-devices (currently numbering 2414). Before publishing your app on the Store you have to manually check/uncheck whether each of these is supported or not. After all, any of these devices can access the GooglePlay-store (as far I can tell), and following that, any would be able to download your game.
Due to the sheer number of devices, testing all of them is ridiculously infeasible. Hell, even going through the list is infeasible. There MUST be a better way. Like “filter all devices without this feature”. That sounds doable.
So while researching a workaround I stumbled upon the Android-Manifest-File. This magical document lets you specify certain requirements of your app, like “Only run of devices with a camera”, or “only run on devices with an Accelerometer”. That’s sounds perfect.
…but unfortunately there was no documentation on how to use it with Unity. Where do I put that file? How does it look like? Where do I find it, assuming it is already present somewhere? No encompassing documentation is available for this problem. So I decided to write my own.
This “issue” pops up when you want to put your Unity-based Android-game onto the GooglePlay-store. I am assuming you have succeeded so far in building and testing your application, and just want to specify the store-requirements in the Manifest-file. Here’s how it works:
- Build your application.
- Luckily Unity creates a Manifest-File automatically. Go to the folder YourUnityProject/Temp/StagingArea. You will a file named “AndroidManifest.xml”. This is the one we are looking for.
- In the Asset-Folder of your project (YourUnityProject/Assets) create a folder called “Plugins”. In that folder, create a folder called “Android”. Copy the AndroidManifest-file in there. It should look like this:
- You can now modify the file from within Unity. If you open it, it looks something like this:
- Near the end of the file, after the /application-tag, are the lines that specify which features are required by the app. Find them.
- A typical line looks like this:
- To make sure it works correctly, add the line
before the “/>” at the end. it should now look like this:
< uses-feature android:name="android.hardware.sensor.accelerometer"
- All the “hardware” features of your app are automatically listed in the manifest-file near the end. By adding android:required=”true” you make sure that only devices with this features can download and install this app.
- If you add android:required=”false” on the other hand, devices without said feature can access it anyway (but get a warning that the app would access it, if it could). This is useful for apps where motion-controls (for example) are available, but not required.
The full list of settings is on the Android-Developer-Site.
Q: What happens if I don’t add “android:required=”true”” to a specific line?
The GooglePlay-store will assume that that feature is required.
Q: So all this stuff happens on its own? I don’t really have to do this entire procedure?
It appears so. The file is generated and included automatically.
Q: Then why are you writing this?
So all this information is in one place, which until now it wasn’t. Also I’m a nice person.