ACCESS_FINE_LOCATION AndroidManifest权限不被授予 [英] ACCESS_FINE_LOCATION AndroidManifest Permissions Not Being Granted

查看:13312
本文介绍了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 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" />

这篇关于ACCESS_FINE_LOCATION AndroidManifest权限不被授予的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆