android-notifications

Notification without “heads up”

这一生的挚爱 提交于 2019-12-10 10:55:28
问题 I am trying to create a notification that has a high priority (a chatting app) but my client requested that there will be no "heads up" view for it. I have tried creating an empty layout for a RemoteViews to set as the Notification.headsUpContentView but still nothing. Here is what I've tried: Intent target = new Intent(this, PushConsumedBroadcastReceiver.class); target.putExtra(PushConsumedBroadcastReceiver.PUSH_TYPE, PushConsumedBroadcastReceiver.PUSH_TYPE_REMINDER); PendingIntent pending =

How to make android unit test for notifications?

一曲冷凌霜 提交于 2019-12-10 08:02:22
问题 I have the class handleFirebaseMessages . It contains the function onMessageReceived() . This function is in charge of receiving data and creating notifications. onMessageReceived() receives data in a RemoteMessages object. I am trying to write a test for this function. But I've not got it completely. HandleFirebaseMessages public class HandleFirebaseMessages extends FirebaseMessagingService { @Override public void onMessageReceived(final RemoteMessage remoteMessage) { final Map<String,

EnhancedIntentService warning On Incoming Notifications

荒凉一梦 提交于 2019-12-10 04:35:12
问题 I have been getting two errors in my log once a notification is received EnhancedIntentService: Service took too long to process intent: com.google.android.c2dm.intent.RECEIVE App may get closed EnhancedIntentService: binding to the service failed There is NOTHING on Google of either of these messages or even EnhancedIntentService . Relevant code: <service android:name="---.GcmMCIntentService" android:exported="false" > <intent-filter android:priority="10"> <action android:name="com.google

Handling status bar notification before it is displayed

狂风中的少年 提交于 2019-12-10 02:21:41
问题 I am using NotificationListenerService to handle device notifications: @Override public void onNotificationPosted(StatusBarNotification sbn) { Log.d(TAG,"onNotificationPosted posted - ID :" + sbn.getId() + "\t" + sbn.getNotification().tickerText + "\t" + sbn.getPackageName()); } The onNotificationPosted() method is called after the notification has been posted on the device. Is there a way to catch it before it is presented? I saw that reading notifications can also be achieved using the

Why does the “download completed” notification disappear on Gingerbread devices?

对着背影说爱祢 提交于 2019-12-10 01:31:09
问题 I'm using the DownloadManager class to programatically download a file. All works fine but I can't get the download completed notifcation to persist. It disappears immediately once the download has completed. Here's my code: Request rqtRequest = new Request(Uri.parse(((URI) vewView.getTag()).toString())); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { rqtRequest.setShowRunningNotification(true); } else { rqtRequest.setNotificationVisibility(Request.VISIBILITY_VISIBLE

Firebase notification sometimes skip onMessageReceived method

馋奶兔 提交于 2019-12-10 00:07:00
问题 When I was using Parse from Facebook, I could test notification while in development (i.e. no app on the Play Store). But right now I am trying to implement Firebase into my app. My app is not published yet. I am done with android side implementation and am trying to send a notification from the Firebase console to my app. But my device never receives the notification. Why is that? I am targeting "All Users" because firebase does not have a version or any of my topics. OKAY So I did some more

Detect if notification has been deleted

给你一囗甜甜゛ 提交于 2019-12-09 19:02:47
问题 I have the following problem. I want to detect when a notification has been removed from the notification bar. I can scan notifications with an AccessbilityService and casting its ParcelableData to a notification Notification notif = (Notification) event.getParcelableData(); One thought of mine was, utilizing if the PendingIntent of the notification has been clicked, but I can't find anything on how to detect that. Any ideas? I am kind of desperate... trying it for hours now. 回答1: A very

android notification large image not working

前提是你 提交于 2019-12-09 18:25:40
问题 I am creating my notification like this: Intent intent = new Intent(this, OfferNotification.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); Uri soundUri = RingtoneManager .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( this).setSmallIcon(R.drawable.unknown) //.setLargeIcon(BitmapFactory.decodeResource( getResources(), R.drawable.unknown)) .addAction(R.drawable.ic_launcher, "d", pIntent)

Remove all notifications from notification bar

旧巷老猫 提交于 2019-12-09 13:15:32
问题 I want to remove all cancelable notifications from status bar. I know how to remove my app notifications I have seen this post before, butI want to remove other apps notifications. There is a "Clear" button in notifications in all android versions which clears all notifications with this flag: Notification.FLAG_AUTO_CANCEL That means it's possible to cancel all notifications. But I haven't found any document about how to do that. Is there anybody guide me how to do that? Thanks 回答1: Starting

startForegroundService() did not call startForeground(), but it did

柔情痞子 提交于 2019-12-09 10:06:52
问题 I'm having the Context.startForegroundService() did not then call Service.startForeground() in my Android service, but I cannot figure out why it is happening. My application is for media streaming, and this error only occurs when you pause from the foreground notification (turning it into a regular notification), and you then swipe the notification away, which is intended to stop my service. Here is the only method where the startForegroundService , startForeground and stopForeground methods