Android 中导入百度地图后,activity已经退出了但是service 还是没有停下
2016-03-13 22:48
417 查看
在导入了百度地图的activity 中,我退出了activity 但是后台的service 还是继续执行,有这样的一条信息
03-13 22:42:11.913 27433-27449/tech.androidstudio.baidulocationdemo I/art:
Background sticky concurrent mark sweep GC freed 272437(9MB) AllocSpace objects, 12(972KB) LOS objects, 27% free, 20MB/28MB, paused 5.857ms total 63.015ms
原因分析,这个是因为我取消LocationClient 的注册的时候没有将LocationClient 进行停止。
解决办法:
在onDestroy 的里面加上 mLocationClient.stop()就可以了,
03-13 22:42:11.913 27433-27449/tech.androidstudio.baidulocationdemo I/art:
Background sticky concurrent mark sweep GC freed 272437(9MB) AllocSpace objects, 12(972KB) LOS objects, 27% free, 20MB/28MB, paused 5.857ms total 63.015ms
原因分析,这个是因为我取消LocationClient 的注册的时候没有将LocationClient 进行停止。
解决办法:
在onDestroy 的里面加上 mLocationClient.stop()就可以了,
@Override protected void onDestroy() { super.onDestroy(); mMapView.onDestroy(); mLocationClient.unRegisterLocationListener(this); //千万别忘了这个stop,如果不stop那么会继续执行 mLocationClient.stop(); }
相关文章推荐
- Android-使用框架布局管理器居中显示层叠的正方形
- Android开发历程_1(从1个activity跳转到另一个activity)
- android 用 XML 自定义View边框个数,只有一边或两边
- Android系统之SD卡分析二
- Android基础知识
- 侧拉菜单Android动画
- Android TouchDelegate
- Android系统之SD卡分析一
- Widget创建过程
- 《Android开发艺术探索》读书笔记 (7) 第7章 Android动画深入分析
- SlidingMenu的学习
- Android 6.0中新的权限模型介绍
- ActivityMQ android开发
- Mac下Android开发
- Android的四大组件
- Android开发资源整合(SDK、ADT、supports、Platforms、System Images)
- Android开发学习之路--RxAndroid之操作符
- Android开发学习之路--RxAndroid之操作符
- Android Instrument测试命令使用小记
- Android Service的两种方式