Issue
I'm developing an Android app (a game) that supports phones and TVs too, and can play multiplayer via LAN (WiFi or Ethernet) or WiFi Direct.
Android Studio warns me with a Lint warning in the manifest that says that if I "require Wifi permissions", then it will "limit the app availability on TVs that support only Ethernet" (TVs that don't have Wifi).
I would like to support TVs without Wifi too. The multiplayer code is written in a way that it handles the Ethernet-only situation.
However, the Wifi-related permissions are normal permissions, and their declarations can't be removed from the manifest.
Is there anything that can be done here to keep my app available for these TVs without Wifi?
Solution
Some permissions, when you request them, cause Android to think that you need the associated hardware. In your case, requesting ACCESS_WIFI_STATE
and CHANGE_WIFI_STATE
cause Android to think that you need WiFi hardware.
Adding <uses-feature android:name="android.hardware.wifi" android:required="false" />
downgrades that from "must have WiFi" to "can use WiFi". Beyond clearing up the Lint complaint, it will help with actual app distribution, allowing your app to run on hardware that has only Ethernet. In addition to some TV platforms, there may be some Chromeboxes that also are Ethernet-only.
But there is no automatic action for the warning about this TV-Ethernet thing
I do not see a bug report for that in the issue tracker. If you are in position to create a throwaway project that has your <uses-permission>
elements, you might consider filing a feature request to get the quick-fix that you seek added to Android Studio.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.