@SuppressWarnings("deprecation")
    public Notification createDefaultNotification() {

        Notification notification = null;
        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            notification = new Notification.Builder(this).setSmallIcon(getApplicationInfo().icon).build();
        } else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            notification = new Notification.Builder(this).setSmallIcon(getApplicationInfo().icon).getNotification();
        } else {
            notification = new Notification();
            notification.icon = getApplicationInfo().icon;
            // temporary fix https://github.com/octo-online/robospice/issues/200
            PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(), 0);
            notification.setLatestEventInfo(this, "", "", pendingIntent);
            notification.tickerText = null;
            notification.when = System.currentTimeMillis();
        }

        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            notification.priority = Notification.PRIORITY_MIN;
        }

        return notification;
    }
@ SuppressWarnings ( "deprecation" ) public Notification createDefaultNotification ( ) { Notification notification = null ; if ( android . os . Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) { notification = new Notification . Builder ( this ) . setSmallIcon ( getApplicationInfo ( ) . icon ) . build ( ) ; } else if ( android . os . Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { notification = new Notification . Builder ( this ) . setSmallIcon ( getApplicationInfo ( ) . icon ) . getNotification ( ) ; } else { notification = new Notification ( ) ; notification . icon = getApplicationInfo ( ) . icon ; PendingIntent pendingIntent = PendingIntent . getActivity ( getApplicationContext ( ) , 0 , new Intent ( ) , 0 ) ; notification . setLatestEventInfo ( this , "" , "" , pendingIntent ) ; notification . tickerText = null ; notification . when = System . currentTimeMillis ( ) ; } if ( android . os . Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) { notification . priority = Notification . PRIORITY_MIN ; } return notification ; }
This method can be overriden in order to create a foreground
SpiceService. By default, it will create a notification that can be used
to set a spiceService to foreground (depending on the versions of
Android, the behavior is different : before ICS, no notification is
shown, on ICS+, a notification is shown with app icon). On Jelly Bean+,
the notifiation only appears when notification bar is expanded / pulled
down.
@return a notification used to tell user that the SpiceService is still
running and processing requests.