[英]How to trigger wifi state change using a background service in android?
I have an application where I want to upload some data as soon as the wifi is turned-on even if the application is not running. 我有一个应用程序,我想在WiFi打开后立即上传一些数据,即使该应用程序未运行也是如此。 I think this can be done using android background services.
我认为可以使用android后台服务来完成。 Please help me uploading the data using background services when the app is not running or suggest me some other way to achieve this.
当应用未运行时,请帮助我使用后台服务上传数据,或者建议我采取其他方法来实现此目的。
Thanks in advance!! 提前致谢!!
To be more eloborate, implement following 为了更加雄辩,请执行以下操作
Hope this is helpful. 希望这会有所帮助。 Let me know if you have any questions.
如果您有任何疑问,请告诉我。
You must use an unbounded service, who is completely independent for the activity (for more details check this ). 您必须使用不受限制的服务,该服务对于活动是完全独立的(有关更多详细信息,请检查此 )。 After starting service monitor your internet connection using ConnectivityManager.
启动服务后,使用ConnectivityManager监视Internet连接。 Use this like example.
使用这种类似的例子。 Have Fun.
玩得开心。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.