My Device(Karbon A 21 Mobile Phone) では、Google Play Services
インストールされていない場合は my location
object がnull
あり、Google Play Services
インストールされている間は正しい場所を返します。
Google Play Services
- を使用してインストールされているかどうかを確認できることはわかっていGooglePlayServicesUtil.isGooglePlayServicesAvailable(this)
ます。しかし、Google Play Services
実用的にインストールできますか、それともユーザーに手動でインストールするように依頼する必要がありますか?
他のアプリGoogle Play Services
がインストールされていないのに場所を表示するのはなぜですか? 私のコードで何か間違ったことをしていますか?以下のコードを参照してください。
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setCostAllowed(true);
provider = locationManager.getBestProvider(criteria, true);
Location location = locationManager.getLastKnownLocation(provider);