Codename One APK Manifest for Android TV: build hints

风格不统一 提交于 2019-12-08 04:07:03

问题


This question is releated to: Codename One APK Manifest for Android TV

I found some documentation here: https://developer.android.com/training/tv/start/start

In this documentation, it's written that 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.

I tried to use the following two build hints (with include sources):

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>

This is my generated AndroidManifest.xml, that maybe have some issues:

<?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>

I note that: <intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LEANBACK_LAUNCHER" /></intent-filter> should be inside an <activity> tag: correct me if I'm wrong. I suppose that the activity should be the same, because there is only one activity. Please note the example at 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>

The second issue is that <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> is repeated two times: is it a default, so I don't have to specify it?

Of course I'm not an expert of AndroidManifest.xml, this question is to ask your opinion about these build hints and the generated Manifest before submitting the app again for the review.


回答1:


You don't need to specify touch screen as it's included by default.

android.xapplication is designed for adding additional activities. I think you should have used android.xintent_filter for this and not android.xapplication.



来源:https://stackoverflow.com/questions/54768764/codename-one-apk-manifest-for-android-tv-build-hints

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!