Service要点总结

来源:互联网 发布:java上传图片 编辑:程序博客网 时间:2024/05/16 08:09
  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

0 0