Android NotificationListenerService - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android NotificationListenerService class.

This code example shows how to use the following methods:
package org.cyanogenmod.voiceplus; 
 
import android.content.Intent; 
import android.content.SharedPreferences; 
import android.service.notification.NotificationListenerService; 
import android.service.notification.StatusBarNotification; 
 
/** 
 * Created by koush on 8/21/13. 
 */ 
public class VoiceListenerService extends NotificationListenerService { 
    SharedPreferences settings;
    @Override 
    public void onNotificationPosted(StatusBarNotification sbn) {
        if (!Helper.GOOGLE_VOICE_PACKAGE.equals(sbn.getPackageName()))
            return; 
        if (settings == null)
            settings = getSharedPreferences("settings", MODE_PRIVATE);
        if (null == settings.getString("account", null))
            return; 

5
CodeRank
This code example shows how to use the following methods:
package com.example.test; 
 
import android.app.Notification; 
import android.content.BroadcastReceiver; 
import android.content.Context; 
import android.content.Intent; 
import android.service.notification.NotificationListenerService; 
import android.service.notification.StatusBarNotification; 
import android.widget.RemoteViews; 
 
public class NotificationListr extends NotificationListenerService { 
 
	public void onCreate(){ 
		 
	} 
	 
	 
	@Override 
	public void onNotificationPosted(StatusBarNotification sbn) {
		// TODO Auto-generated method stub 

4
CodeRank
This code example shows how to use the following methods:
import android.os.Build; 
import android.service.notification.NotificationListenerService; 
import android.service.notification.StatusBarNotification; 
 
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) 
public class MyListenerService extends NotificationListenerService { 
    private static final String TARGET_APP_PACKAGE = "com.google.android.gm"; // Gmail Application
 
 
    @Override 
    public void onNotificationPosted(StatusBarNotification sbn) {
        // return if the notification isn't from the target 
        if (!TARGET_APP_PACKAGE.equals(sbn.getPackageName())) {
            return; 
        } 
 
        // get intent from notification 
        Notification notification = sbn.getNotification();
 
        if (TARGET_APP_PACKAGE.equals(sbn.getPackageName())) {
4
CodeRank
This code example shows how to use the following methods:
import com.asa.notif.hangouts.AppData; 
 
/** 
 * Created by Aaron on 7/25/13. 
 */ 
public class HangoutNotificationListenerService extends NotificationListenerService { 
 
    @Override 
    public void onNotificationPosted(StatusBarNotification sbn) {
        // TODO - Use a ContentProvider to store the notifications. 
        // TODO - Use the "addWatchContentUris(String[]) call in teh extension class to watch for data changes. 
        Log.d("", "");
        Notification notif = sbn.getNotification();
        int id = sbn.getId();
        String packageName = sbn.getPackageName();
        if (TextUtils.equals(packageName, AppData.HANGOUTS_PACKAGE_NAME)) {
            handleNotification(); 
        } 
        NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext());
        PendingIntent pIntent = notif.contentIntent;
4
CodeRank
This code example shows how to use the following methods:
package com.asa.dashclock.notifications; 
 
import android.service.notification.NotificationListenerService; 
import android.service.notification.StatusBarNotification; 
 
/** 
 * Created by Aaron on 7/25/13. 
 */ 
public class DashNotificationListenerService extends NotificationListenerService { 
 
    @Override 
    public void onNotificationPosted(StatusBarNotification sbn) { 
        // TODO - Use a ContentProvider to store the notifications. 
        // TODO - Use the "addWatchContentUris(String[]) call in teh extension class to watch for data changes. 
    } 
 
    @Override 
    public void onNotificationRemoved(StatusBarNotification sbn) { 
 
    } 

4
CodeRank
See Code Examples for Android NotificationListenerService Methods: