<receiver android:name=".LocationReceiver">     <intent-filter>         <action android:name="com.myapp.swarm.LOCATION_READY" />         <category android:name="android.intent.category.DEFAULT" />     </intent-filter> </receiver> 

public class LocationReceiver extends BroadcastReceiver {     @Override     public void onReceive(Context context, Intent intent) {     //Do this when the system sends the intent     Bundle b = intent.getExtras();     Location loc = (Location)b.get("KEY_LOCATION_CHANGED");      Toast.makeText(context, loc.toString(), Toast.LENGTH_SHORT).show();      } }

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. android中封装http请求
  2. 关于android studio报错Attempt to invok
  3. android使程序进程不被LMK杀死
  4. 关于百度地图Android
  5. Android 本地文件上传到服务器
  6. 初试Android基于Vuforia开发AR
  7. OpenSignal给出的Android现状分析及技巧
  8. android 自定义软键盘
  9. android菜单和对话框
  10. android 下用ant编译脚本执行批量渠道打