1
我尝试在我的android应用程序中显示用户位置,但它dosnt工作!包管理器始终为空。为什么包管理器始终为空?
private void openPrefredLocationInMap(){
String location =
PreferenceManager.getDefaultSharedPreferences(this)
.getString(getString(R.string.pref_location_key)
, getString(R.string.pref_defult));
Uri geoLocation = Uri.parse("geo:0,0?").buildUpon()
.appendQueryParameter("q", location).build();
Intent intent= new Intent(Intent.ACTION_VIEW,geoLocation);
if (intent.resolveActivity(getPackageManager()) != null)
startActivity(intent);
else
Log.d("package","couldnt call"+location);
}