android-notifications

Android , broadcasting parcelable data

感情迁移 提交于 2019-12-04 19:08:04
问题 I've implemented a class that extends NotificationListenerService which works fine for picking up on notifications posted. I'm then wanting to take the statusBarNotification object received and broadcast it. I'd doing the following: @Override public void onNotificationPosted(StatusBarNotification statusBarNotification) { Intent intent = new Intent(); intent.putExtra("STATUS_BAR_NOTIFICATION",statusBarNotification); intent.setAction("com.example.NotificationPosted"); sendBroadcast(intent); }

Android Notification with DecoratedCustomViewStyle

懵懂的女人 提交于 2019-12-04 18:06:44
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 still obtain system decorations like the notification header with the expand affordance and actions. So I

Starting the app from Notification remove it from recent app history

早过忘川 提交于 2019-12-04 17:04:19
问题 I have a problem in one of my apps when I start it from a notification. It never appears in the "recent app" list. Without notifications, every thing works as expected: I start the app, navigate into and when I quit it (with home button or back button) after that I can go back into it with a long press on home button => ok. The problem starts when I receive a notification. If I start the app from the notification, it starts the correct screen and I can use the app => ok. But when I quit the

Android BLE notifications for Glucose

醉酒当歌 提交于 2019-12-04 15:56:42
问题 I tired to use Android BLE SDK to communication with my Glucose device. I need setCharacteristicNotification for UUID 2a18 and 2a34. I refer to the Android official SDK as follows: http://developer.android.com/guide/topics/connectivity/bluetooth-le.html#notification BluetoothGattCharacteristic charGM = mConnGatt.getService(UUID.fromString(BleUuid.SERVICE_GLUCOSE)) .getCharacteristic(UUID.fromString(BleUuid.CHAR_GLUCOSE_MEASUREMENT_STRING)); mConnGatt.setCharacteristicNotification(charGM,

Notification.Builder(context) deprecated Android O [duplicate]

醉酒当歌 提交于 2019-12-04 15:25:55
问题 This question already has answers here : NotificationCompat.Builder deprecated in Android O (9 answers) Closed 2 years ago . Notification.Builder(context) has been deprecated recently with the venue of Notification Channels in Android O. PROBLEM: After using Notification.Builder(context, StringID) instead of Notification.Builder(context) I did receive a notification to my Android O device. However, after trying that on an Android 23 (M), I did not receive a notification. I debugged my code

How to get notification id?

守給你的承諾、 提交于 2019-12-04 14:44:46
问题 i developed an basic notification example and tried to catch which notification clicked. But i couldnt. I put an arraylist my notificaiton and pass it to reciever activity by putting extras, then try to catch but no way ! Are there anyway to catch which one cliked ? 回答1: You can pass a Bundle along with PendingIntent to the next Activity. Bundle bundle = new Bundle(); bundle.putString("Any String"); NotificationManager notifManager = (NotificationManager) this.getSystemService(this

Creating a notification for MediaPlayer with an Android Foreground Service

半城伤御伤魂 提交于 2019-12-04 14:12:02
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 generic class for the noticication would be a good idea. Here is the kind of view i would like to

Get Google Maps Navigation Instructions

烈酒焚心 提交于 2019-12-04 14:02:54
问题 I'm looking for a way to get the instructions from Maps Navigation. Currently I think the only possible way is to read the notification data that is placed at the top by Maps Navigation. My reason for beleving that this is the only way comes from this post. I tried getting the data with the OnNotificationPosted method, but i cant find directions data in the StatusBarNotification object... Does anyone have a solution or better idea on how to achieve this 回答1: You can implement a

Detect if notification has been deleted

让人想犯罪 __ 提交于 2019-12-04 11:41:32
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. Michell Bak A very similar question has already been answered here on SO: Detect a new Android notification In short,

Fragments and Notifications: Target different Activities from Notification; depending on screen configuration

。_饼干妹妹 提交于 2019-12-04 10:42:22
问题 Question: How to decide what Activity a Notification should launch if the target might depend on the configuration (screen size, orientation etc); as is often the case when one uses Fragment s? Details: Let's consider the NewsReader sample that demonstrates how to use Fragment s to produce an app that plays well with multiple screen sizes and orientations. This app is structured as follows: A HeadlinesFragment . An ArticleFragment . A "main" activity ( NewsReaderActivity ). In dual pane mode,