A bundle's execution context within the Framework. The context is used to grant access to other methods so that this bundle can interact with the Framework
解释:框架内包的执行上下文,这个上下文有权限被用来访问其他的方法因此这个包可以与框架进行交互。
说白了就是创建BundleContext的实例我们可以获得一个与框架进行交互上下文。
获得方式有两种:
A BundleContext
object will be created and provided to the bundle associated with this context when it is started using the BundleActivator.start(org.osgi.framework.BundleContext)
method.
The same BundleContext
object will be passed to the bundle associated with this context when it is stopped using the BundleActivator.stop(org.osgi.framework.BundleContext)
就是当我们实现了BundleContext的stop方法时他的参数是BundleContext