J.D*_*DOE 5 notifications android appicon
我想在通知栏中更改应用程序名称,但找不到简单的解决方案。他们说必须更改应用程序名称。我找到了这个库。
https://github.com/myinnos/AppIconNameChanger
但是太麻烦了。每次更改需要 10 秒。有没有机会使用简单的解决方案仅更改通知栏中的应用程序名称?
这是我的通知示例代码
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this.getApplicationContext(), "notify_001");
Intent ii = new Intent(this.getApplicationContext(), MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, ii, 0);
NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
bigText.bigText("Big text");
bigText.setBigContentTitle("Big content title");
bigText.setSummaryText("summary text");
mBuilder.setContentIntent(pendingIntent);
mBuilder.setSmallIcon(R.drawable.ic);
mBuilder.setContentTitle("Content Title");
mBuilder.setContentText("Content text");
mBuilder.setPriority(Notification.PRIORITY_MAX);
mBuilder.setStyle(bigText);
NotificationManager mNotificationManager =
(NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel("notify_001",
"Channel human readable title",
NotificationManager.IMPORTANCE_DEFAULT);
mNotificationManager.createNotificationChannel(channel);
}
mNotificationManager.notify(0, mBuilder.build());
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4757 次 |
最近记录: |