简体   繁体   English

Android NotificationCompat未显示在jar中

[英]Android NotificationCompat is not showing in jar

Hi I used following code to show notifications. 嗨,我使用以下代码显示通知。

NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
                .setSmallIcon(R.drawable.notification_image)
                .setContentTitle("Notification")
                .setContentText("Test Notifications")
                .setPriority(Notification.PRIORITY_HIGH)
                .setVibrate(new long[0]);
        NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(10, builder.build());

It was showing correctly before creating .jar file. 创建.jar文件之前,它显示正确。 Once I create .jar and use it in another app means it is not showing. 一旦创建.jar并在其他应用程序中使用它,它就不会显示。 Can anybody help me to solve this?Thanks in advance. 有人可以帮助我解决这个问题吗?

Notification has a small icon. 通知带有一个小图标。 if you make it to .jar file,it hasn't contain drawable resources. 如果将其保存为.jar文件,则其中不包含可绘制资源。 Please make it to .aar file and use it in another app. 请使其成为.aar文件,并在其他应用程序中使用它。

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

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