Code example for Messenger

Methods: getBinder

     * When binding to the service, we return an interface to our messenger 
     * for sending messages to the service. 
    public IBinder onBind(Intent intent) {
        return mMessenger.getBinder();
     * Show a notification while this service is running. 
    private void showNotification() { 
        // In this sample, we'll use the same text for the ticker and the expanded notification 
        CharSequence text = getText(R.string.remote_service_started);
        // Set the icon, scrolling text and timestamp 
        Notification notification = new Notification(R.drawable.stat_sample, text,
        // The PendingIntent to launch our activity if the user selects this notification