Code example for Binder

0
import android.os.IBinder; 
import android.os.UserHandle; 
import android.widget.Toast; 
 
public class SingleUserService extends Service {
    Binder mBinder = new Binder();
 
    @Override 
    public void onCreate() { 
        super.onCreate(); 
        Toast.makeText(this,
                "Service created as user " + UserHandle.myUserId(), 
                Toast.LENGTH_LONG).show();
    } 
 
    @Override 
    public IBinder onBind(Intent intent) {
        return mBinder;
    } 
}