Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove application from Notification Center

Tags:

Hey I was playing around with making a small cocoa application and using the new Notification Center API in Mountain Lion. However my app is now present in the notification center settings, together with Calendar, Messages and so on.

As it was just me playing around I want it to disappear from the list now, but I cannot find anyway to remove it, tried several things, dragging it out, holding alt+right click and so on. Does anyone know where the (probably a) plist that populates that list could be located?

like image 327
robahl Avatar asked Aug 16 '12 18:08

robahl


People also ask

How do I remove items from Mac Notification Center?

To add or remove an app notification, you go to System Preferences > Notifications. On the left is a list of apps that provide notifications. Click on the app you want, and then its settings appear on the right side. Check/uncheck the Show in Notification Center box to add/remove its notifications.

How do you delete something from your notifications?

From the Notifications tab, click or tap the three dots next to a notification, and then click or tap "Remove this notification" to delete it.

How do I remove an app from the Notification Center on my Iphone?

You don't drag an item to remove it from Notification Center. Uncheck "Show in Notification Center" and any other applicable options. As to a delete, you need to delete the application to remove it from appearing in Notification Center.


2 Answers

I was stuck in the same boat.

While I don't believe purging applications from Notification Center that have once registered is a documented step, there's clearly some stuff setup to do that. Here's what I found out. This data isn't stored in a plist but rather a sqlite database.

If you look ~/Library/Application Support/NotificationCenter/<id> (in my case, I only had one directory under NotificationCenter), you'll see an <id>.db file under the directory.

Editor's note: Hofi points out that since macOS 10.10 said SQLite database can be found in the directory returned by shell command
$(getconf DARWIN_USER_DIR)com.apple.notificationcenter/db, named just db.

Poking inside, I see tables like app_info, app_source, presented_notifications, etc. Furthermore, the schema includes a clean-up trigger that looks like this:

CREATE TRIGGER app_deleted AFTER DELETE ON app_info BEGIN     DELETE FROM scheduled_notifications     WHERE app_id=old.app_id;     DELETE FROM presented_notifications     WHERE app_id=old.app_id;     DELETE FROM presented_alerts                WHERE app_id=old.app_id;     DELETE FROM notifications                   WHERE app_id=old.app_id;     DELETE FROM app_push                        WHERE app_id=old.app_id;     DELETE FROM app_loc                     WHERE app_id=old.app_id;      DELETE FROM app_source                 WHERE app_id=old.app_id; END; 

Using a sqlite3 client, if you do a

select * from app_info; 

the first column is the app_id of your application, the second column is your app's bundleid. Find your application based on the bundleid. Then do a

delete from app_info where app_id = <app_id> 

where is the correct app_id you found using your select command above.

What was frustrating was that after doing this, everything stayed around in NotificationCenter (both the center and System Preferences). I had to logout and log back in to see the changes take effect, but luckily, my multiple test apps are now gone ;-)

If anyone knows of a less convoluted way, I'm all ears.

like image 93
SeafoodBuffet Avatar answered Oct 13 '22 03:10

SeafoodBuffet


Highlight the app in the list and hit fn+backspace or del/delete if you have that on your keyboard.

like image 23
jwswart Avatar answered Oct 13 '22 03:10

jwswart