Service要点总结

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zfan93/article/details/51363520
  1. 打开Service的两种方法:startServiceIntent intent)(打开后不管,不“手动关闭”就一直运行)

                                                bindServiceIntent intentServiceConnection connint flags)(和打开者绑定,共存亡)

  1. 关闭service的种方式:stopServiceIntent intent)(与startService对应)

                                           unbindServiceServiceConnnection conn)(与bindService对应)

  1. 两种打开关闭方式对应的生命周期:startService-onCreate-onStartCommand-(关闭service-onDestroy

                                                                      bindService-onCreate-onBind-(取消绑定)-onUnbind-onDestroyonRebind

猜你喜欢

转载自blog.csdn.net/zfan93/article/details/51363520
今日推荐