5

My Device(Karbon A 21 Mobile Phone) では、Google Play Servicesインストールされていない場合は my locationobject が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);
4

1 に答える 1