android-notifications

Android notification not working

最后都变了- 提交于 2019-11-30 18:27:51
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."; Intent notificationIntent = new Intent(context, CastrActivity.class); PendingIntent contentIntent =

Getting Detail/Expanded Text from an Android Notification?

可紊 提交于 2019-11-30 18:23:26
问题 I've implemented a notification listener to look out for a Gmail notification. I want to collect the expanded text (bigtext) from the notification as shown in the notification below: See "----Forwarded message---", etc. which only appears when the user expands the notification to show the action buttons. This string value does not appear in the notification's "EXTRAS" data... http://developer.android.com/reference/android/app/Notification.html 回答1: After viewing the above link, I further

Android Lollipop App Notification Settings

岁酱吖の 提交于 2019-11-30 18:10:34
问题 In Android Lollipop, when you long press a Notification, it gives you access to settings for that Notification's app, such as priority, or simply blocking it. Is there an intent that I can use to access those settings? 回答1: Found the answer here - https://plus.google.com/+CyrilMottier/posts/YY6tbJrJMra You need to add this to the activity you want to be attached to that settings icon <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent

Handle the data payload without user tapping on the notification?

依然范特西╮ 提交于 2019-11-30 17:56:55
问题 When in the background, apps receive the notification payload in the notification tray, and only handle the data payload when the user taps on the notification. Is there any way to handle the data payload without user tapping on the notification? 回答1: Basing from the FCM docs on Handling Messages: App state Notification Data Both Foreground onMessageReceived onMessageReceived onMessageReceived Background System tray onMessageReceived Notification: system tray Data: in extras of the intent. It

How can I create notification that is different on device and wear?

て烟熏妆下的殇ゞ 提交于 2019-11-30 17:55:10
问题 Basically, I am wondering if it is possible to create two different notifications and how - one for Android Device and other for Android Wear? For example: I want to have just setContentText , but on Android device I want setContentTitle and setContentText There is currently no possibility to show notification just on Wear (like setLocalOnly with device only - look for more). 回答1: I think the Synchronized Notifications sample that comes with the Android Wear SDK may be useful to look at. It

How to create a notification without icon in the statusbar or simply hide it?

穿精又带淫゛_ 提交于 2019-11-30 17:50:49
I'd like to know how to create a notification that doesn't show the icon in the statusbar. There is a way to hide it? Since Android 4.1 (API level 16) it's possible to specify a notification's priority . If you set that flag to PRIORITY_MIN the notification icon won't show up on the statusbar. notification.priority = Notification.PRIORITY_MIN; Or in case you use a Notification.Builder : builder.setPriority(Notification.PRIORITY_MIN); As of Android 8.0 Oreo (API level 26) you have to set the importance of the notification's NotificationChannel to IMPORTANCE_MIN : NotificationChannel channel =

How to animate the progress notification icon

ぐ巨炮叔叔 提交于 2019-11-30 17:41:49
问题 I am building the notification progress bar in Service in such a way that is given below : private NotificationManager mNotifyManager; private NotificationCompat.Builder mBuilder; mBuilder = new NotificationCompat.Builder(DownloadService.this) .setSmallIcon(R.drawable.download) .setContentTitle("MayUp") .setContentText("Downloading new tools") .setTicker("Downloading in progress"); mBuilder.setAutoCancel(true); Intent targetIntent = new Intent(DownloadService.this, ListClass.class);

Full Screen Notification only showing as a Heads Up

自闭症网瘾萝莉.ら 提交于 2019-11-30 17:15:19
I have been banging my head against the table with this problem for 3 days now, please tell me where I have strayed. When I am getting an incoming VoIP call, I am trying to show a full screen notification, just like the PhoneApp does. I am ok with heads up, if the user is in an immersive activity. However, I am getting only a heads up notification, and never getting a full screen. I need to notification to ignore the lock screen as well. Here is what I am doing: String callJson = call.toJson(uber).toString(); uber.requestWakeState(UberVoice.WAKE_STATE_FULL); final Notification.Builder builder

How to create a notification without icon in the statusbar or simply hide it?

帅比萌擦擦* 提交于 2019-11-30 16:45:47
问题 I'd like to know how to create a notification that doesn't show the icon in the statusbar. There is a way to hide it? 回答1: Since Android 4.1 (API level 16) it's possible to specify a notification's priority. If you set that flag to PRIORITY_MIN the notification icon won't show up on the statusbar. notification.priority = Notification.PRIORITY_MIN; Or in case you use a Notification.Builder : builder.setPriority(Notification.PRIORITY_MIN); As of Android 8.0 Oreo (API level 26) you have to set

getActiveNotifications always null when using NotificationListenerService

泪湿孤枕 提交于 2019-11-30 16:20: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.NotificationListener flg=0x10 (has extras) } in utils.NotificationListener$NLServiceReceiver@42680780 04