ACCESS_FINE_LOCATION AndroidManifest权限不被授予不被、权限、ACCESS_FINE_LOCATION、AndroidManifest

由网友(习惯的看别人幸福)分享简介:我想利用全球定位系统的Andr​​oid(2.2和2.3),但我得到以下错误,当我尝试使用LocationManager对象:I am trying to utilize GPS in Android (2.2 and 2.3) but am getting the following error when I tr...

我想利用全球定位系统的Andr​​oid(2.2和2.3),但我得到以下错误,当我尝试使用LocationManager对象:

I am trying to utilize GPS in Android (2.2 and 2.3) but am getting the following error when I try to use the LocationManager object:

WARN / System.err的(522):java.lang.SecurityException异常:提供网络需要ACCESS_FINE_LOCATION或ACCESS_COARSE_LOCATION许可

我研究这个问题在其他职位,他们通常是由于与AndroidManifest.xml中的问题。然而,矿似乎是罚款:

I have researched the issue in other posts and they are typically due to issues with AndroidManifest.xml. However, mine appears to be fine:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.thedigitalsean.examples"
  android:versionCode="1"
  android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".GetLocation"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
<uses-permission android:name="android.permisssion.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permisssion.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permisssion.INTERNET"></uses-permission>
</manifest>

下面是code中的违规行我在的getLocation活动onCreate方法,装在一个try / catch块:

Here is the offending line of code in my onCreate method in the GetLocation Activity, encased in a try/catch block:

    LocationManager locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
    final LocationListener locListener = new MyLocListener();

    try{
        locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locListener);
    }
    catch (SecurityException se){
        ((TextView)findViewById(R.id.infobox)).setText(se.toString());
        se.printStackTrace();
    }

这是第一个应用程序我写,我需要请求Android权限和迄今未能成功被授予任何任何权限。有什么我在我的表现或许在我的Eclipse配置很想念?

This is the first app I have written where I need to request android permissions and have so far been unsuccessful in being granted any permissions whatsoever. Is there something I am missing in my manifest or perhaps in my eclipse configuration?

推荐答案

您拼错许可

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
阅读全文

相关推荐

最新文章