ngCordova capture not working on device

2019-08-15 17:15发布

问题:

I'm am attempting to record audio using Ionic and ngCordova.

Here is my code: $scope.captureAudio = function() { var options = { limit: 3, duration: 10 };

$cordovaCapture.captureAudio(options).then(function(audioData) {
  // Success! Audio data is here
  alert(audioData);
  console.log(audioData);
}, function(err) {
  // An error occurred. Show a message to the user
  alert(err);
});
};

When I run this in the emulator it works fine and brings up the voice recorder and when the recording is done it logs out the audioData.

When I upload it to ionic view and run it I get nothing. Not even an error.

Has anyone seen anything like this before ?

Thanks Kevin

回答1:

$cordovaCapture plugin is not yet supported by ionic view.

Please see the list of supported plugins in this link.

You can run the code in device directly using run command.

ionic run android