簡體   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