1

매우 간단한 방법이라고 생각되지만 지오 로케이션 모듈을 호출하려고하는데 오류가 발생합니다. Android 4.4.2를 실행하는 삼성 Galaxy S3의 실제 휴대 전화를 테스트 중입니다. 오류 로그에 반환되는 여기에Appcelerator Titanium 5.5.1 Android Geolocation 모듈 checkSelfPermission 및 requestPermissions 오류가 발생합니다.

function getGPSCoordinates() { 
    if (Ti.Geolocation.locationServicesEnabled) { 
    Ti.Geolocation.purpose = 'Corollate photos with store location'; 
    Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS; 
    Ti.Geolocation.getCurrentPosition(function(e) { 
     if (e.error == true) 
     console.error(e.error); 
     else 
     console.warn(e.coords); 
    }); 
    } 
} 

if (Ti.Geolocation.locationServicesEnabled) 
    getGPSCoordinates(); 
else { 
    Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE, function(e) { 
    getGPSCoordinates(); 
    }); 
} 

... 그리고 : 여기 내 페이지의 컨트롤러의 .js 내에서 실행되고있는 코드가의

[INFO] : dalvikvm: Could not find method android.app.Activity.checkSelfPermission, referenced from method ti.modules.titanium.geolocation.GeolocationModule.hasLocationPermissions 
[WARN] : dalvikvm: VFY: unable to resolve virtual method 27: Landroid/app/Activity;.checkSelfPermission (Ljava/lang/String;)I 
[INFO] : dalvikvm: Could not find method android.app.Activity.requestPermissions, referenced from method ti.modules.titanium.geolocation.GeolocationModule.requestLocationPermissions 
[WARN] : dalvikvm: VFY: unable to resolve virtual method 74: Landroid/app/Activity;.requestPermissions ([Ljava/lang/String;I)V 

나는 깨끗한했다 빌드하고 문제가 지속됩니다. 또한 빌드/안드로이드/AndroidManifest.xml을 쳐다 보면서 적절한 권한이 자동으로 매니페스트에 추가되는 것을 볼 수 있습니다 : 다음과 같이

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/> 

내 개발 환경의 관련 부분은 다음과 같습니다

Operating System 
    Name      = Mac OS X 
    Version      = 10.11.6 
    Architecture    = 64bit 
    # CPUs      = 8 
    Memory      = 16.0GB 

Node.js 
    Node.js Version    = 0.12.7 
    npm Version     = 2.11.3 

Appcelerator CLI 
    Installer     = 4.2.7 
    Core Package    = 5.5.1 

Titanium CLI 
    CLI Version     = 5.0.9 
    node-appc Version   = 0.2.31 

Titanium SDKs 
    5.5.1.GA 
    Version     = 5.5.1 
    Install Location   = /Users/xxxxxxxxxx/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA 
    Platforms     = android, mobileweb, iphone 
    git Hash     = b18727f 
    git Timestamp    = 09/27/16 05:38 
    node-appc Version   = 0.2.36 

Mac OS X 
    Command Line Tools   = installed 

Intel® Hardware Accelerated Execution Manager (HAXM) 
    Installed     = yes 
    Memory Limit    = 2 GB 

Java Development Kit 
    Version      = 1.8.0_102 
    Java Home     = /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home 

Android SDK 
    Android Executable   = /Users/xxxxxxxxxx/Library/Android/sdk/tools/android 
    ADB Executable    = /Users/xxxxxxxxxx/Library/Android/sdk/platform-tools/adb 
    SDK Path     = /Users/xxxxxxxxxx/Library/Android/sdk 

Android NDK 
    NDK Path     = not found 
    NDK Version     = not found 

Android Platforms 
    1) android-23 
    Name      = Android 6.0 
    API Level     = 23 
    Revision     = 3 
    Skins      = HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800, WVGA854, WXGA720, WXGA800, WXGA800-7in 
    ABIs      = x86 
    Path      = /Users/xxxxxxxxxx/Library/Android/sdk/platforms/android-23 

Android Add-Ons 
    None 

Connected Android Devices 
SPH-L710 
    ID       = 8c1af53b 
    State      = device 
    SDK Version     = 4.4.2 (android-19) 
    ABIs      = armeabi-v7a, armeabi 

내가해야 할 일이 있다면 다르게 알려주세요. 고맙습니다!

답변

0

앱에 기기에 대한 위치 권한이 있습니까? 설정을 확인하고 앱을 사용 설정하고 위치를 요청하기 전에 권한이 있는지 확인하는 방법 (https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Geolocation-method-requestLocationPermissions)을 확인하십시오.

또 다른 보고서에는 비슷한 보고서가있어 통찰력을 줄 수 있습니다. (Appcelerator Could not find method android.app.Activity.checkSelfPermission)

+0

Ti.Geolocation.locationServicesEnabled = false를 감지하면 requestLocationPermissions() 메소드가 호출됩니다. 이전에 언급 한 다른 스레드를 보았지만 스크린 샷은 수동으로 설정에 들어가 GPS를 켜는 것입니다. 나는 대부분의 사람들이 GPS를 끈 상태라고 생각하고 있는데, Appcelerator가 필요하다면 다시 켜도록 요구하기를 원한다. – ComputerTinker

+0

코드를 실행할 때 앱에서 GPS를 사용하도록 요청 하시겠습니까? Android 7을 실행하는 Nexus 6P에서 코드를 신속하게 시도했지만 문제없이 작동했습니다. – Ray

+0

아니, 그 요청을 본 적이 없지만 그것이 내가 원하는 일이다. 사용중인 Android 버전과 관련된 작동 방식에 버그가있는 것 같습니다. https://jira.appcelerator.org/browse/TIMOB-23135 – ComputerTinker

관련 문제