renative
renative copied to clipboard
Mulitbuild for Android and Android TV
Many times there is only one APK needed which covers both Android as well as Android TV. To achieve this, the AndroidManifest.xml
needs the intent-filter with category android.intent.category.LAUNCHER
as well as android.intent.category.LEANBACK_LAUNCHER
.
Of course this can be achieved by modifying the appconfig's renative.json, but maybe there could be a more easy way, for eg. a boolean option in the configuration.
@pavjacko Is this something which you think is good for renative? If yes, I think about it to implement this config option.
@maximilize so to achieve above result you should only need this
renative.json
:
"android": {
"AndroidManifest": {
"children": [
{
"tag": "application",
"android:name": ".MainApplication",
"children": [
{
"tag": "activity",
"android:name": ".MainActivity",
"children": [{
"tag": "intent-filter",
"children": [
{
"tag": "category",
"android:name": "android.intent.category.LEANBACK_LAUNCHER"
}
]
}]
}
]
}
]
}
}
and run app with
rnv run -p android --skipTargetCheck
to show TV targets as well
now you could make a shortcut version of it but be-aware it has implications to stuff like
- general UX
- conditional compilation options (index.android.js vs index.androidtv.js vs index.tv.js)
- different focus management options
so we could enable basic flag ie "enableAndroidTV" which injects mentioned snippet. wouldn't do more than that until we got above topics nailed down conceptually
Actually there are quite many TV boxes out there which are not real Android TV, mostly from China. They are not supporting the LEANBACK_LAUNCHER
category by default, but focus management is working on such boxes since Android 7 with a little modification of the react-native Platform.isTV
code. I currently don't see so much more differences than the conditional compilation.
However, I will do more tests over time on this topic.
ok. let's give it a shot. for the PR we need to start documenting such API changes / additions. in this case that would be https://github.com/pavjacko/renative/blob/develop/docs/DOC_PLAT_ANDROID.md which ends up here https://renative.org/docs/android
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.