Help using Cordova plugin

Just starting out? Need help? Post your questions and find answers here.
Num3
Posts: 18
Joined: Wed Apr 09, 2014 7:09 pm

Help using Cordova plugin

Post by Num3 »

I am trying to understand the workings of the Cordova plugin sistem, but even with debugger the following code just crashes the app with no debug info whatsoever on Chrome :(

It is a barcode reading plugin from here:
https://www.npmjs.com/package/org.madmo ... barscanner

Any help would be appreciated!

Code: Select all


Import "cordova plugins add cordova-plugin-cszbar"
EndImport


Procedure Events()
 
  Select EventGadget()
    Case 0
      VibrateDevice(1000)
     
    Case 1
      Debug DeviceInfo(#PB_Device_Model)
      Debug DeviceInfo(#PB_Device_Platform)
      Debug DeviceInfo(#PB_Device_UUID)
      Debug DeviceInfo(#PB_Device_Version)
      Debug DeviceInfo(#PB_Device_Manufacturer)
      Debug DeviceInfo(#PB_Device_Serial)
     
    Case 2
      Debug BatteryLevel()
     
    Case 3
      Debug "AccelerometerX: " + AccelerometerX()
      Debug "AccelerometerY: " + AccelerometerY()
      Debug "AccelerometerZ: " + AccelerometerZ()
      Debug "AccelerometerTime: " + AccelerometerTime()
     
    Case 4
      Debug "GeolocationLatitude: " + GeolocationLatitude()
      Debug "GeolocationLongitude: " + GeolocationLongitude()
      Debug "GeolocationAltitude: " + GeolocationAltitude()
      Debug "GeolocationSpeed: " + GeolocationSpeed()     
      Debug "GeolocationHeading: " + GeolocationHeading()     
      Debug "GeolocationTime: " + GeolocationTime()     
      
    Case 5
      ; THIS IS WHERE I AM RUNNING THE PLUGIN.
      ; --------------------------------------
      
      !cloudSky.zBar.scan({text_title: "Title Text"}, function (success) { v_sb = success;
          Debug sb.s
      !}, function(failure) { v_sb = failure;
          Debug sb.s
      !});
      
  EndSelect
 
EndProcedure

Procedure OnSizeDesktop()
  Debug "size desktop"
  ExamineDesktops()
  Debug "DesktopWidth(): " + DesktopWidth(0)
  Debug "DesktopHeight(): " + DesktopHeight(0)
EndProcedure


OpenWindow(0, 0, 0, 300, 350, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
ButtonGadget(0, 0, 0, 300, 25, "Vibrate")
ButtonGadget(1, 0, 30, 300, 25, "SystemInfo")
ButtonGadget(2, 0, 60, 300, 25, "BatteryLevel")
ButtonGadget(3, 0, 90, 300, 25, "Accelerometer")
ButtonGadget(4, 0, 120, 300, 25, "Geolocation")
ButtonGadget(5, 0, 120, 300, 25, "Barcode")
StringGadget(6, 0, 150, 300, 50, "Geolocation", #PB_String_PlaceHolder)

StartAccelerometer(100)
StartGeolocation(30000)

BindEvent(#PB_Event_Gadget, @Events())
BindEvent(#PB_Event_SizeDesktop, @OnSizeDesktop())
plouf
Posts: 196
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Re: Help using Cordova plugin

Post by plouf »

have not used plugin for now, bt what do you mean by "chrome" ?
isnt cordova plugins explicit used for MobileApp's ?
Christos
Num3
Posts: 18
Joined: Wed Apr 09, 2014 7:09 pm

Re: Help using Cordova plugin

Post by Num3 »

plouf wrote:have not used plugin for now, bt what do you mean by "chrome" ?
isnt cordova plugins explicit used for MobileApp's ?
I am testing an Android build. The plugin it's designed for reading barcodes.
With Android apps you can connect Google chrome and remote debug and control the app, but the this plugin crashes without any error :(
tj1010
Posts: 201
Joined: Wed May 27, 2015 1:36 pm
Contact:

Re: Help using Cordova plugin

Post by tj1010 »

This is an interesting question because I also need some plugins and cordova modules but don't want to reverse engineer to find out how the library function works.
Post Reply