android-notifications

How to do notification in android?

有些话、适合烂在心里 提交于 2019-11-30 05:24:15
问题 I am doing a helpdesk application on android. I want to implement a notification for unread tickets(customer suggestions or complaints). In iPhone version of this app, even if the app is not open a counter for unread tickets on the app icon itself, is it possible in android. If it so please help me to implement like iPhone otherwise help me to implement normal android notification for unread tickets. Thanks 回答1: call this method private void triggerNotification(String s) { CharSequence title

Custom Notification Sound not working in Oreo

柔情痞子 提交于 2019-11-30 04:57:07
Uri sound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + context.getPackageName() + "/" + R.raw.notification_mp3); mBuilder.setSound(sound); I had copied the mp3 (notification_mp3.mp3) file into the raw folder in the res folder. When the notification is triggered it produces given mp3 sound upto Android Nougat but default sound in Android Oreo . I had referred many sites but nothing worked on Android Oreo . I didn't find any changes in Android Docs regarding notification sound in Android O & above. What changes should be done to make this code working in Android O too? Ankush To

Changing notification icon background on Lollipop

℡╲_俬逩灬. 提交于 2019-11-30 04:08:48
I was going through the Notifications design pattern , and didn't find anything that talks about notification icon background. As you probably noticed, there is only a light grey background for custom notifications. But apps like Hangouts, or simply the USB Debugging notification has a custom color for their notification icon background. Is there any possibility to change that grey into something else? (that specific circle's color programmatically) 1) Obtain Color int color = 0xff123456; int color = getResources().getColor(R.color.my_notif_color); int color = ContextCompat.getColor(context, R

Background execution not allowed. Android O pendingintent

牧云@^-^@ 提交于 2019-11-30 03:24:46
问题 I have a service that schedules a pendingintent which starts my notification. However, since Android O I am getting this error. I did some research, and stumbled upon context.registerReceiver , but that does not seem to fix the problem. Error: W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:my.great.package flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa

Android notification not working

蓝咒 提交于 2019-11-30 03:17:44
问题 I've been attempting to get a notification of a successful upload from an ASyncTask to work all day. I'm not getting any errors from my current code but I can't get the notification to show in the notification bar (or anywhere else). I get no messages in LogCat and no notification appears in the Notification bar. This is my code: Notification mNotification = new Notification(icon, tickerText, when); CharSequence contentTitle = "upload completed."; CharSequence contentText = "upload completed.

Android: Grouped notifications and summary still shown separately on 4.4 and below

时间秒杀一切 提交于 2019-11-30 03:10:50
I want to implement stacked notifications on Android Wear To do that I create 1 summary notification and N individual notifications for each "item". I want only the summary to be shown on the phone. Here's my code: private void showNotifications() { NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); showNotification1(notificationManager); showNotification2(notificationManager); showGroupSummaryNotification(notificationManager); } private void showNotification1(NotificationManager notificationManager) { showSingleNotification

Android push notification: Get data, store and display on new activity on click of notification

对着背影说爱祢 提交于 2019-11-30 01:39:01
I am developing an application which is having push notification functionality. I followed the following link as Android Push Notification I tried and successfully send URL and open the web page on click of notification by doing the following change in code of generateNotification(). /** * Issues a notification to inform the user that server has sent a message. */ private static void generateNotification(Context context, String message) { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new

Get value from RemoteMessage from FCM onMessageReceived method

廉价感情. 提交于 2019-11-30 00:26:37
问题 I have migrate gcm to fcm for push notification message. but how I Get bundle data from RemoteMessage received onMesssageReceived method. Old GCM give bundle data onMessageReceiced method but in FCM there is RemoteMessage data. So please tell me how I parse remotemessage for get all value of notification. MY PAYROL { "collapse_key":"score_update", "priority":"high", "content_available":true, "time_to_live":108, "delay_while_idle":true, "data": { "message": "Message for new task", "time": "6

getActiveNotifications always null when using NotificationListenerService

左心房为你撑大大i 提交于 2019-11-30 00:08:56
问题 I followed this Sample Code of kpBird and this Developer Guide I can : Call intent to this service. Can catch Broadcast from Notification. So I got the error getActiveNotifications always null . I don't know why, People who know, please help me, Thanks, p/s : Here is source code and error I get. Error : 04-28 08:46:11.625: E/AndroidRuntime(7651): FATAL EXCEPTION: main 04-28 08:46:11.625: E/AndroidRuntime(7651): java.lang.RuntimeException: Error receiving broadcast Intent { act=app.trekband

PendingIntent not opening Activity in Android 4.3

橙三吉。 提交于 2019-11-29 22:55:17
In my Service , I open up a notification on normal run, using this code: private final static NOTIFICATION_ID = 412434; private void startNotification() { NotificationCompat.Builder builder = new NotificationCompat.Builder( this); builder.setSmallIcon(R.drawable.notification); builder.setContentTitle("Running"); final Intent intent = new Intent(this, MainActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); final PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE