Page 1 of 1

Help using Cordova plugin

Posted: Wed Apr 26, 2017 12:26 pm
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())

Re: Help using Cordova plugin

Posted: Wed Apr 26, 2017 6:25 pm
by plouf
have not used plugin for now, bt what do you mean by "chrome" ?
isnt cordova plugins explicit used for MobileApp's ?

Re: Help using Cordova plugin

Posted: Wed Apr 26, 2017 9:12 pm
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 :(

Re: Help using Cordova plugin

Posted: Sat Apr 29, 2017 6:02 am
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.