gpt4 book ai didi

android - 关于缺少 Leanback Intent 的 Google Play 警告

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:14:00 25 4
gpt4 key购买 nike

在 Google Play 上更新我们的应用时,我得到了

You opted-in to Android TV but your APK or Android App Bundle does not have the Leanback intent

这有点奇怪,因为我们的 list 中包含支持电视所需的所有组件,即:

<uses-feature
android:name="android.software.leanback"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />

    <activity
android:name=".MainActivity"
android:configChanges="orientation"
android:launchMode="singleTop"
android:screenOrientation="behind"
android:theme="@style/AppTheme.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>

<application
android:banner="@drawable/tv_banner"

(请注意,我们在电视和手机之间共享 Activity )

我们还包括以下 gradle 模块:

implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:leanback-v17:27.1.1'

该应用程序也适用于电视设备:)

现在,诚然,我们已经进行了重大重构,因此我们的应用程序和 list 的结构发生了很大变化。但是,我没有看到任何与 Android 开发文档中的要求相矛盾的地方:

https://developer.android.com/training/tv/start/start

有人遇到过吗?或者,任何人都可以看到其他明显缺失/不正确的东西吗?

最佳答案

终于找到答案了!

如果您想支持 AndroidTV,则无法在 list 中锁定方向。

android:screenOrientation="landscape"
android:screenOrientation="portrait"

相反,您可以在 Activity 的 onCreate 中使用以下代码(或类似的代码)

requestedOrientation =
if (isPhoneDevice()) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
else ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE

如果您的 list 中没有锁定方向逻辑,则可能是某些库添加了它。使用 apk 工具反编译您的 apk,然后验证生成的 list 。您可以将其替换为以下代码:

<activity
android:name="com.yoursite.SampleActivity"
tools:replace="android:screenOrientation"
tools:node="merge"
android:screenOrientation="sensor"/>

希望对你有帮助:)

编辑:我发现了另一个问题。

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

您不能在 Android TV 上使用 ACCESS_WIFI_STATE 权限。

关于android - 关于缺少 Leanback Intent 的 Google Play 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51929882/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com