android-notifications

Android Notification: add typeface for title and content

﹥>﹥吖頭↗ 提交于 2019-12-22 08:57:42
问题 I'm trying to add a Typeface in my NotificationCompat.Builder -> setContentTitle() and setContentText() . I initialized Typeface by Typeface banglaFont = Typeface.createFromAsset(this.getAssets(), "kalpurush.ttf"); in IntentService . To create Notification i used following code. NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( this) .setLargeIcon(bitmap) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(userName) .setAutoCancel(true) // .setStyle( // new

android 7.0 Notification icon appearing white square

萝らか妹 提交于 2019-12-22 05:27:06
问题 I am using the below snippet to generate notifications in my android app. private void sendNotification(String contentText, String message) { Intent resultIntent = new Intent(this, MainActivity.class); resultIntent.putExtra("clear","clear"); resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent piResult = PendingIntent.getActivity(this, 0, resultIntent,0); NotificationCompat.Builder builder=new NotificationCompat.Builder(this) .setSmallIcon(R

NotificationListenerService with RemoteController.OnClientUpdateListener crashes on API18 (4.3)

落爺英雄遲暮 提交于 2019-12-21 23:39:48
问题 The Problem I want to implement the new RemoteController API, which has been introduced with API19 (Kitkat,4.4). The API requires me to implement a class which extends from NotificationListenerService (introduced with API18) and implements the RemoteController.OnClientUpdateListener interface. (Further information on how to implement all this can be found here and a very helpful example project can be found here) Everything's working as it should on my API19 (Kitkat,4.4) device and every

Android Notification with DecoratedCustomViewStyle

…衆ロ難τιáo~ 提交于 2019-12-21 21:42:24
问题 I'm trying to create a Notification on Android 7 with a custom layout but I want to use the DecoratedCustomView Style from the v7-Support Library: https://developer.android.com/reference/android/support/v7/app/NotificationCompat.DecoratedCustomViewStyle.html The reason why I want to use this style is that I want to use the notification header provided by android, as the documentation states: Instead of providing a notification that is completely custom, a developer can set this style and

Creating a notification for MediaPlayer with an Android Foreground Service

你说的曾经没有我的故事 提交于 2019-12-21 20:17:25
问题 Here is the problem. I am currently working on an application that must provide : A Radio Player (AAC live streaming from an url) And a PodCast player (MP3 Streaming from an url) The application must be able to run in background (Android Service) and be exposed to the user with a persistant notification in the Notification Bar (Android Foreground Service) (ONE problem per question so here i'll be asking for the notification) Since i have several class for managing players, i though creating a

Creating a notification for MediaPlayer with an Android Foreground Service

廉价感情. 提交于 2019-12-21 20:16:15
问题 Here is the problem. I am currently working on an application that must provide : A Radio Player (AAC live streaming from an url) And a PodCast player (MP3 Streaming from an url) The application must be able to run in background (Android Service) and be exposed to the user with a persistant notification in the Notification Bar (Android Foreground Service) (ONE problem per question so here i'll be asking for the notification) Since i have several class for managing players, i though creating a

NoClassDefFound in NotificationCompat.Builder

隐身守侯 提交于 2019-12-21 15:00:10
问题 The concept is to get notification at a specific time. Obviously, I did it, until I included the support for versions lower than HoneyComb and above it. I have set min SDK version 8 and target SDK 17. As the class coding is much bigger, I am showing only the core area where the problem exists: int currentapiVersion = android.os.Build.VERSION.SDK_INT; Notification notification; PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, TaskDetails.class), 0); if

NotificationCompat cannot be resolved to a type

断了今生、忘了曾经 提交于 2019-12-21 12:43:13
问题 I am newer to Android and receive the error message: "NotificationCompat cannot be resolved to a type" MinSDK=9, TargetSDK=18, As of yet, all sources are very vague on how to resolve this issue and simply note: "update the JAR files". What JARs do I need and where can I find them, so that this issue is resolved? 回答1: You need the support library. Here are the instructions on how to download them: http://developer.android.com/tools/support-library/setup.html I needed to add "android-support-v4

android system notification limit per app

こ雲淡風輕ζ 提交于 2019-12-21 11:05:08
问题 This may be off topic , but I couldn't found anything for it. Is there any limit on the number of notifications android app can display ?I am facing issue after 100 notifications. There is no documentation which states this clearly. Note: This is not really a good idea to show 100 notifications but It is required for certain reasons. Any help would be good. 回答1: In API23 package com.android.server.notification; NotificationManagerService.java static final int MAX_PACKAGE_NOTIFICATIONS = 50;

Android Oreo Does not Play Custom Sound for Notification

会有一股神秘感。 提交于 2019-12-21 09:06:36
问题 I am trying to add a custom sound to notification for API > 26. Below is the code NotificationChannel notificationChannel = new NotificationChannel("channel id","channel name",NotificationManager.IMPORTANCE_HIGH); mNotificationManager.createNotificationChannel(notificationChannel); AudioAttributes audioAttributes = new AudioAttributes.Builder() .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) .setUsage(AudioAttributes.USAGE_NOTIFICATION) .build(); notificationChannel.setSound(Uri.parse(