React Native - Android TV - DPad功能

问题描述 投票:4回答:2

我已经发布了一个反应本机应用程序谷歌播放商店为Android电视。

对于电视,我收到了以下通知:

缺少DPad功能您的应用需要用户交互菜单或应用程序导航。请确保使用DPad完成所有菜单和应用程序导航。请参阅我们的DPAD控制和硬件声明文档。

我们如何为react-native android应用程序启用d-pad导航?

如果您需要更多信息,请告诉我。

android reactjs react-native google-play-console
2个回答
3
投票

最后,我已经修复了d-pad导航和反应原生android电视应用程序横幅的问题。

问题是:(这包括甚至不是问题的一部分的问题)

1.没有全尺寸的应用横幅

修复:在create a folder called drawable下的"your-app/android/app/src/main/res",添加一个png文件(dimensions 320px x 180px and 320 dpi),最重要的部分是,你发布的within image, there should be no other text then application name APK。

2.不支持的硬件用途

修复:我在发布问题之前解决了这个问题,但如果您遇到问题,

refer the answer by **@reidisaki** on this question.

3.缺少DPad功能(问题中提出的实际问题)

修复:我在屏幕上使用InputText。好吧,在react-native version 0.56下为android / android tv,InputText cannot be focused by d-pad(方向键盘)。 I stopped using TextInput并修复了d-pad导航。它也可以在Android模拟器中使用,以测试应用程序。

为了使我的应用程序更符合电视,在AndroidManifest.xml中我将活动启动器升级为:

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter>

为Android tv升级主题到leanback:

  1. added leanback library到依赖项部分下的“app-name / android / app / build.gradle”: dependencies { .... compile "com.android.support:leanback-v17:${rootProject.ext.supportLibVersion}" }
  2. 在AndroidManifest.xml中,我将主题更改为@style/Theme.Leanback <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:banner="@drawable/banner" android:allowBackup="true" android:theme="@style/Theme.Leanback"> .... </application>

1
投票

您的清单是否声明了正确的用途 - 功能?主要是第一个otne touchScreen需要假

<uses-feature android:name="android.hardware.touchscreen"
        android:required="false"/>
<uses-feature android:name="android.hardware.faketouch"
        android:required="false"/>
<uses-feature android:name="android.hardware.telephony"
        android:required="false"/>
<uses-feature android:name="android.hardware.camera"
        android:required="false"/>
<uses-feature android:name="android.hardware.nfc"
        android:required="false"/>
<uses-feature android:name="android.hardware.location.gps"
        android:required="false"/>
<uses-feature android:name="android.hardware.microphone"
        android:required="false"/>
<uses-feature android:name="android.hardware.sensor"
        android:required="false"/>

我正在寻找发布一个Android电视应用程序以及反应原生,但androidtv的焦点管理有错误,如果你点击右键但项目是垂直上方和右侧android电视什么也没做。

编辑------------您是否尝试过实施这些配置?

<uses-configuration
  android:reqFiveWayNav=["true" | "false"]
  android:reqHardKeyboard=["true" | "false"]
  android:reqKeyboardType=["undefined" | "nokeys" | "qwerty" | "twelvekey"]
  android:reqNavigation=["undefined" | "nonav" | "dpad" | "trackball" | "wheel"]
  android:reqTouchScreen=["undefined" | "notouch" | "stylus" | "finger"] />
© www.soinside.com 2019 - 2024. All rights reserved.