繁体   English   中英

适用于 Android TV 的 Codename One APK Manifest:构建提示

[英]Codename One APK Manifest for Android TV: build hints

这个问题与: Codename One APK Manifest for Android TV

我在这里找到了一些文档: https : //developer.android.com/training/tv/start/start

本文档中写道, If you do not include the CATEGORY_LEANBACK_LAUNCHER intent filter in your app, it is not visible to users running Google Play on TV devices.

我尝试使用以下两个构建提示(包含源):

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

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

这是我生成的AndroidManifest.xml ,可能有一些问题:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="net.informaticalibera.apps.unialeph"
      android:versionCode="100"
      android:versionName="1.0"
      xmlns:tools="http://schemas.android.com/tools"
      android:minSdkVersion="15"
      android:installLocation="auto">
    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="27"  />
    <supports-screens android:smallScreens="true"
          android:normalScreens="true"
          android:largeScreens="true"
          android:xlargeScreens="true"
          android:anyDensity="true" />
  <application  android:label="UniAleph"  android:icon="@drawable/icon"  android:allowBackup="true" >
<provider
          android:name="android.support.v4.content.FileProvider"
          android:authorities="${applicationId}.provider"
          android:exported="false"
          android:grantUriPermissions="true">
          <meta-data
              android:name="android.support.FILE_PROVIDER_PATHS"
              android:resource="@xml/file_paths">
          </meta-data>
      </provider><meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>        <activity android:name="UniAlephStub"
                  android:theme="@style/CustomTheme"
                  android:configChanges="orientation|keyboardHidden|screenSize"
                  android:launchMode="singleTop"
                  android:label="UniAleph">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
  <intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LEANBACK_LAUNCHER" /></intent-filter><receiver android:name="com.codename1.impl.android.LocalNotificationPublisher" ></receiver>
<service android:name="com.codename1.impl.android.BackgroundFetchHandler" android:exported="false" />
<activity android:name="com.codename1.impl.android.CodenameOneBackgroundFetchActivity" android:theme="@android:style/Theme.NoDisplay" />
<activity android:name="com.codename1.location.CodenameOneBackgroundLocationActivity" android:theme="@android:style/Theme.NoDisplay" />
<service android:name="com.codename1.location.BackgroundLocationHandler" android:exported="false" />
<service android:name="com.codename1.location.GeofenceHandler" android:exported="false" />
<service android:name="com.codename1.media.AudioService" android:exported="false" />    </application>
    <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    <uses-feature android:name="android.hardware.telephony" android:required="false" />
    <uses-permission android:name="android.permission.INTERNET" android:required="false" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:required="false" />
  <uses-feature android:name="android.software.leanback" android:required="false" /><uses-feature android:name="android.hardware.touchscreen" android:required="false" /></manifest>

我注意到: <intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LEANBACK_LAUNCHER" /></intent-filter>应该在<activity>标签内:如果我错了,请纠正我。 我想活动应该是一样的,因为只有一个活动。 请注意https://developer.android.com/training/tv/start/start 中的示例:

<application
  android:banner="@drawable/banner" >
  ...
  <activity
    android:name="com.example.android.MainActivity"
    android:label="@string/app_name" >

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

  <activity
    android:name="com.example.android.TvActivity"
    android:label="@string/app_name"
    android:theme="@style/Theme.Leanback">

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

  </activity>
</application>

第二个问题是<uses-feature android:name="android.hardware.touchscreen" android:required="false" />重复了两次:是默认的,所以我不用指定吗?

当然我不是AndroidManifest.xml 的专家,这个问题是在再次提交应用以供审核之前询问您对这些构建提示和生成的Manifest 的意见。

您不需要指定触摸屏,因为它默认包含在内。

android.xapplication旨在添加额外的活动。 我认为您应该为此使用android.xintent_filter而不是android.xapplication

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM