Android开发—Service学习一(实时给服务器发送GPS位置)

本文介绍了Android开发中Service组件的应用,强调Service并非独立进程或线程,而是用于在后台持续运行任务。以实时发送GPS信息到服务器为例,详细讲述了Service的生命周期和如何创建线程处理耗时操作。示例代码展示了GPSLocationListener的实现,实现了将GPS数据发送到Servlet服务器。后续计划在服务器端进一步开发,以显示地图并实时展示位置。
摘要由CSDN通过智能技术生成

学习来源:《网易云课堂-Android4.0应用开发第一季》

Service作为Android的四大组件之一,常见的功能如闹钟、音乐播放、网络加载图片等都是Service实现的。

今天总结一下我之前写得通过Service给服务器实时发送GPS信息。


首先,需要提出的是,在Android开发官网中,有关于以下的说明:

Most confusion about the Service class actually revolves around what it is not:

  • A Service is not a separate process. The Service object itself does not imply it is running in its own process; unless otherwise specified, it runs in the same process as the application it is part of.
  • A Service is 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值