mobile/src/main/java/drost_stein/fbg/hsbo/de/urbantrackingapp/LocationService.java
private void showNotification() {
        // In this sample, we'll use the same text for the ticker and the expanded notification
        CharSequence text = getText(R.string.location_service_started);

        // The PendingIntent to launch our activity if the user selects this notification
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                new Intent(this, MainActivity.class), 0);

        // Set the info for the views that show in the notification panel.
        Notification notification = new Notification.Builder(this)
                .setSmallIcon(R.drawable.urban_tracker_app_logo)  // the status icon
                .setTicker(text)  // the status text
                .setWhen(System.currentTimeMillis())  // the time stamp
                .setContentTitle(getText(R.string.app_name))  // the label of the entry
                .setContentText(text)  // the contents of the entry
                .setContentIntent(contentIntent)  // The intent to send when the entry is clicked
                .build();

        // Send the notification.
        mNM.notify(R.string.location_service_started, notification);
    }
/**
     * Show a notification while this service is running.
     */
Show a notification while this service is running.
Show a notification while this service is running .
private void showNotification() {
        CharSequence text = getText(R.string.location_service_started);
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                new Intent(this, MainActivity.class), 0);
        Notification notification = new Notification.Builder(this)
                .setSmallIcon(R.drawable.urban_tracker_app_logo)  
                .setTicker(text)  
                .setWhen(System.currentTimeMillis())  
                .setContentTitle(getText(R.string.app_name))  
                .setContentText(text)  
                .setContentIntent(contentIntent)  
                .build();
        mNM.notify(R.string.location_service_started, notification);
    }
private void showNotification ( ) { CharSequence text = getText ( R . string . location_service_started ) ; PendingIntent contentIntent = PendingIntent . getActivity ( this , 0 , new Intent ( this , MainActivity . class ) , 0 ) ; Notification notification = new Notification . Builder ( this ) . setSmallIcon ( R . drawable . urban_tracker_app_logo ) . setTicker ( text ) . setWhen ( System . currentTimeMillis ( ) ) . setContentTitle ( getText ( R . string . app_name ) ) . setContentText ( text ) . setContentIntent ( contentIntent ) . build ( ) ; mNM . notify ( R . string . location_service_started , notification ) ; }
Show a notification while this service is running.
Show a notification while this service is running .
// In this sample, we'll use the same text for the ticker and the expanded notification // The PendingIntent to launch our activity if the user selects this notification // Set the info for the views that show in the notification panel. // the status icon // the status text // the time stamp // the label of the entry // the contents of the entry // The intent to send when the entry is clicked // Send the notification.