- Android
-
2011-12-05 - 更新:2011-12-14
クラス直下で宣言
private PendingIntent pi; LocationManager mLocationManager; ReceiveLocation receiver;
onCreate内に以下を記述
mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE); receiver = new ReceiveLocation(); //指定したIntentに反応するようにReceiverにIntentFilterを登録 final IntentFilter filter = new IntentFilter(); filter.addAction("com.android.practice.ACTION_LOCATION_UPDATE"); registerReceiver(receiver, filter);

3,517 views