JavaScript Cordova Android 'Uncaught Function required as first argument' caused by event listeners cordova android version,cordova android target not installed,cordova android

Ionic AngularJS Cordova app running on Android

I have a service which inits some event listeners. Some work whereas two are causing the app to crash with the logcat error

Uncaught Function required as first argument!

The function registering the event listeners

var _init = function () {
        var onDeviceReady = function () {
            _startCamera();
            window.addEventListener('orientationchange', _startCamera);
            document.addEventListener('pause', _stopCamera(), false);  // causes crash on start
            document.addEventListener('resume', _startCamera(), false);  // causes crash on start
        };
        document.addEventListener('deviceready', onDeviceReady, false);
    };

The event listeners for deviceready and orientationchange work; however, if I leave in the ones for pause or resume the app crashes. If I comment out both of those lines the app runs fine.

My defs for _startCamera and _stopCamera

var _stopCamera = function () {
        ...
    };

var _startCamera = function () {
        ...
    };

I have tried:

  1. Changing the function declarations to be _stopCamera function () { ... } instead, no change
  2. Declaring those two functions before or after _init, no change
  3. Placing the two addEventListeners in question both outside of onDeviceReady and inside, no change

--How can I resolve the issue of Cordova claiming it's a bad function call?

Answer:1

I want to use leaflet marker (for latLng) and a slider (for radius) for my search form. The mongodb part will be like location: { $geoWithin: { $centerSphere: [[lon, lat], radius] } } But ...

I want to use leaflet marker (for latLng) and a slider (for radius) for my search form. The mongodb part will be like location: { $geoWithin: { $centerSphere: [[lon, lat], radius] } } But ...

I need to interpret text copied from emails. Currently, the users copy the text of the email and paste it into an HTML text area. I already have a 90% solution, but here is one case that is stumping ...

I need to interpret text copied from emails. Currently, the users copy the text of the email and paste it into an HTML text area. I already have a 90% solution, but here is one case that is stumping ...

  1. paste special with format vba
  2. paste special with multiply
  3. paste special with formula
  4. paste special with keyboard
  5. paste special with divide
  6. paste special with vba
  7. paste special with transpose vba
  8. paste special with formula vba
  9. paste special with operation
  10. paste special with cut
  11. paste special with text
  12. special paste in excel
  13. special paste in word
  14. special paste in excel shortcut
  15. special paste in ms word
  16. special paste in excel not working
  17. special paste in excel 2010
  18. special paste in excel vba
  19. special paste in autocad
  20. shortcut for paste special in excel

I want to know how to execute some function when I close my browser... so the detail is I making website that going to sell items and the scenario is user login to my website and then they select some ...

I want to know how to execute some function when I close my browser... so the detail is I making website that going to sell items and the scenario is user login to my website and then they select some ...

  1. execute a function after some time javascript
  2. execute a function after some time python
  3. execute a function after some time java

I'm using bootstrap-select and everything is working fine,until options of my select tag are filled with data from php file. I have seen each post on this topic, but there is no answer. So here is an ...

I'm using bootstrap-select and everything is working fine,until options of my select tag are filled with data from php file. I have seen each post on this topic, but there is no answer. So here is an ...

  1. bootstrap select with search
  2. bootstrap select with checkboxes
  3. bootstrap select with images
  4. bootstrap select with label
  5. bootstrap select with text input
  6. bootstrap select with placeholder
  7. bootstrap select with icon
  8. bootstrap select with input
  9. bootstrap select with search box
  10. bootstrap select with search example
  11. bootstrap select with ajax
  12. bootstrap select with input field
  13. bootstrap select with custom input
  14. bootstrap select with bootstrap 4
  15. bootstrap select with angular
  16. bootstrap select with thumbnails
  17. bootstrap select with search angular
  18. bootstrap select with filter
  19. bootstrap select with groups
  20. bootstrap select with dropdown