Android Service执行unbind后再次执行bind的问题

  在执行了startService、bindService、unbindService之后,再次执行bindService。这时发现Service的onBind方法并没有执行,而是执行的onRebind方法,但是有个要求,就是在onUnbind方法的时候返回true。

  如果onUnbind方法返回false,则调用bindService的时候onBind不再执行,而且调用unbindService的时候,onUnbind也不会执行。

  如果onUnbind方法返回true,再次调用bindService的时候会执行onRebind,再调用unbindService的时候,onUnbind也会执行。

  

  

原文地址:https://www.cnblogs.com/huanyou/p/5062076.html