`
wang_peng1
  • 浏览: 3905063 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

LocationManager 的requestLocationUpdates用于本地信息更新

阅读更多
<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();  
    } 
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics