Code example for Messenger

Methods: getBinder

0
     * When binding to the service, we return an interface to our messenger 
     * for sending messages to the service. 
     */ 
    @Override 
    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,
                System.currentTimeMillis());
 
        // The PendingIntent to launch our activity if the user selects this notification 
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,