requestPermissions is not defined

plugins

#1

I am trying to use the phone Camera in my app but I am getting the requestPermission is not defined error…


#2

Camera module internally uses the nativescript-permissions plugin to acquire required permissions, make sure it’s there installed in your node_modules.

If still facing issue, please paste the exact full error log.


#3

System.err: com.tns.NativeScriptException:
System.err: Calling js method onClick failed
System.err:
System.err: ReferenceError: requestPermissions is not defined
System.err: File: "file:///data/data/org.nativescript.application/files/app/app.js, line: 1, column: 201652
System.err:
System.err: StackTrace:
System.err: Frame: function:‘onRequestPermissions’, file:‘file:///data/data/org.nativescript.application/files/app/app.js’, line: 1, column: 201653
System.err: Frame: function:‘n’, file:‘file:///data/data/org.nativescript.application/files/app/app.js’, line: 1, column: 2742
System.err: Frame: function:‘t’, file:‘file:///data/data/org.nativescript.application/files/app/app.js’, line: 1, column: 11985
System.err: Frame: function:‘Observable.notify’, file:‘file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/data/observable/observable.js’, line: 103, column: 23
System.err: Frame: function:‘Observable._emit’, file:‘file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/data/observable/observable.js’, line: 120, column: 18
System.err: Frame: function:‘ClickListenerImpl.onClick’, file:‘file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/button/button.js’, line: 26, column: 23
System.err:
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:957)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:941)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err: at com.tns.gen.java.lang.Object_button_19_32_ClickListenerImpl.onClick(Object_button_19_32_ClickListenerImpl.java:12)
System.err: at android.view.View.performClick(View.java:6103)
System.err: at android.view.View$PerformClick.run(View.java:23147)
System.err: at android.os.Handler.handleCallback(Handler.java:836)
System.err: at android.os.Handler.dispatchMessage(Handler.java:103)
System.err: at android.os.Looper.loop(Looper.java:203)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6284)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1094)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
ActivityManager: Process org.nativescript.application (pid 16647) has died
ActivityManager: handleAppDiedLocked: app = ProcessRecord{e05585f 16647:org.nativescript.application/u0a242}, app.pid = 16647
ActivityManager: cleanUpApplicationRecord – 16647


#4

Are you making a call to requestPermissions method form your code? Would you mind posting your code?


#5

#6

Yeah I am and that is the code.


#7

What exactly are you referring to? We don’t see your code, we only see the stacktrace you posted. :wink:


#8

#9

Here, have an updated Playground.


#10

okay let me try it out


#11

Thanks @Eddy… it worked like charm, so i had to request the permission on page-load first.


#12

@Eddy I see you have nativescript-mapbox guide on Github, I’m trying to implement it in Nativescript-vue. How can you help?