마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 앱 gps 관련

0 추천

사용자의 위치를 가져오는 소스를 만들고있는데 실행은 되지만 밑에 화면처럼 빨간 줄이 나오고

        Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException` less... (Ctrl+F1)<!-- end marker -->

This inspection looks at Android API calls that have been annotated with various support annotations (such as RequiresPermission or UiThread) and flags any calls that are not using the API correctly as specified by the annotations.

Examples of errors flagged by this inspection:

  • Passing the wrong type of resource integer (such as R.string) to an API that expects a different type (such as R.dimen).
  • Forgetting to invoke the overridden method (via super) in methods that require it
  • Calling a method that requires a permission without having declared that permission in the manifest
  • Passing a resource color reference to a method which expects an RGB integer value.

...and many more.     이런 오류가 뜹니다 어떤게 문제인지 모르겠습니다

       

  

preserve0 (140 포인트) 님이 2016년 7월 13일 질문

1개의 답변

0 추천
관련 퍼미션들을 다 추가 하셨나요?
캬옹이 (37,920 포인트) 님이 2016년 7월 13일 답변
네 2가지
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
추가했습니다
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
이것도 추가해보세요. 기지국 정보를 이용한 위치 확인
...