requestPermissions is not defined



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


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.


System.err: com.tns.NativeScriptException:
System.err: Calling js method onClick failed
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: 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: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(
System.err: at com.tns.Runtime.callJSMethodImpl(
System.err: at com.tns.Runtime.callJSMethod(
System.err: at com.tns.Runtime.callJSMethod(
System.err: at com.tns.Runtime.callJSMethod(
System.err: at
System.err: at android.view.View.performClick(
System.err: at android.view.View$
System.err: at android.os.Handler.handleCallback(
System.err: at android.os.Handler.dispatchMessage(
System.err: at android.os.Looper.loop(
System.err: at
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at$
System.err: at
ActivityManager: Process org.nativescript.application (pid 16647) has died
ActivityManager: handleAppDiedLocked: app = ProcessRecord{e05585f 16647:org.nativescript.application/u0a242}, = 16647
ActivityManager: cleanUpApplicationRecord – 16647


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



Yeah I am and that is the code.


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



Here, have an updated Playground.


okay let me try it out


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


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