Android : 权限似乎不起作用,图标不想显示

Android : Permission doesn't seems to work and icon doesn't want to display

我有一个可以在 android 电视上运行的应用,所以在将它发布到 App Store 之前,我想在我自己的 Android 电视上测试它。

但是当我安装它时我遇到了 3 个问题:

1) 我不知道为什么,但我的权限似乎不起作用

2) 我的应用程序没有显示在菜单上,您只能在设置中找到它-->应用程序

3) 图标是android默认图标而不是我自己的图标

这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.package">

<!-- read sd card -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- write sd card -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- location -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- internet -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- internet state -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- to disable recent app button -->
<uses-permission android:name="android.permission.REORDER_TASKS" />
<!-- AccountManager -->
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<!-- same -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- don't rember -->
<uses-permission android:name="android.permission.GET_TASKS"/>

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

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
    <activity android:name=".MainActivity"
        android:banner="@drawable/my_logo_temp"
        android:icon="@drawable/my_logo_temp"
        android:label="@string/app_name"
        android:logo="@drawable/my_logo_temp"
        android:screenOrientation="landscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <service
        android:name=".account.AuthenticatorService"
        android:exported="true"
        android:process=":auth" >
        <intent-filter>
            <action android:name="android.accounts.AccountAuthenticator" />
        </intent-filter>

        <meta-data
            android:name="android.accounts.AccountAuthenticator"
            android:resource="@xml/auth" />
    </service>
</application>



</manifest>

将您的 "logo" 图标放入 mipmap 文件夹并更改以下内容:

android:banner="@mipmap/my_logo_temp"
android:icon="@mipmap/my_logo_temp"
android:logo="@mipmap/my_logo_temp"

以上是答案希望对你有帮助。

案例 3:从 Mainactivity 中删除横幅和图标它应该始终在应用程序标签上,因此将其放在应用程序标签中。

案例 2:删除现有主题并在应用程序标签上应用 android:theme="@style/Theme.Leanback"

开始开发电视应用程序时,我总是喜欢写这么多代码。

<uses-feature
    android:name="android.hardware.touchscreen"
    android:required="false" />
<uses-feature
    android:name="android.software.leanback"
    android:required="true" />
<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" />

<supports-screens
    android:largeScreens="true"
    android:normalScreens="false"
    android:requiresSmallestWidthDp="720"
    android:smallScreens="false"
    android:xlargeScreens="true" />

    <-- Your Permission -->
    <-- You Application Tag -->

不要忘记在 build.gradle 文件中添加编译 'com.android.support:leanback-v17:23.2.1' 依赖项。我在创建应用程序时使用了此依赖项,您可以根据您的项目更改版本。

试试这个可能对你有帮助。

对于情况1:权限问题,如果执行上述所有步骤,将得到解决。