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

查看:37
本文介绍了ACCESS_FINE_LOCATION 未授予 AndroidManifest 权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Android(2.2 和 2.3)中使用 GPS,但是当我尝试使用 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: Provider network requires ACCESS_FINE_LOCATION or 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>

这是 GetLocation Activity 中的 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天全站免登陆