问:Android Studio中的更改通知图标 [英] Q: Change notification icon in Android Studio

查看:107
本文介绍了问:Android Studio中的更改通知图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我配置了应用程序图标(图像1),但是通知图标(通过Firebase发送的通知)显示了一个灰色矩形(图像2). 通过Android Studio 2.3或脚本更改通知图标图像(图像2)的过程是什么?

I configured the application icon (Image 1), but the notification icon (Notification sent via Firebase) shows a gray rectangle (Image 2). What is the procedure for changing the notification icon image (Image 2) via Android Studio 2.3 or via script?

清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.studioshow.studioshow">
<uses-permission android:name="android.permission.INTERNET" />
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <activity android:name=".MainActivity">

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

            <category android:name="android.intent.category.LAUNCHER" />


        </intent-filter>
    </activity>
</application>

推荐答案

清单文件中.设置元数据. 以下是我的情况.

In manifest file. Set meta data. Following code is my case.

   <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar"  >
        <activity
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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


        <service
            android:name=".MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_launcher" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/whitechoke" />

    </application>

这篇关于问:Android Studio中的更改通知图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆