我不想獲取當前位置,但在大多數手機中失敗。 接下來是mycode的:android獲取當前位置失敗
public Location getLocation(Context context)
{
LocationManager locMan = (LocationManager) context
.getSystemService(Context.LOCATION_SERVICE);
Location location = locMan
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location == null)
{
location = locMan
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
}
return location;
}
它*失敗* thats **非常有幫助。 – JoxTraex 2012-02-22 08:45:04
需要更多信息。您是否已將所需的權限添加到清單中? – Tony 2012-02-22 08:51:57
你是否有任何錯誤..如果是這樣粘貼堆棧跟蹤 – Chet 2012-02-22 08:52:53