E
E
Evgeny Popov2015-01-21 13:19:26
JavaScript
Evgeny Popov, 2015-01-21 13:19:26

How to connect cordova plugin to ionic?

The essence of the problem:

  1. Installed and working: ionic, cordova, ngCordova (the module for OAuth is already used from there, which works through the org.apache.cordova.inappbrowser plugin)
  2. I install the plugin in a project on the ionic framework (for example: cordova plugin add org.apache.cordova.media)
  3. In the list of plugins (cordova plugin list) it is displayed
  4. I reinstall the platform, in the process of reinstallation in the log you can see the entire list of plugins from the "list of plugins", it successfully completes
  5. We launch the application (ionic run android) if we do not use the functionality of the "new" plugin (org.apache.cordova.media), then the application works.
  6. If we use the functionality of the plugin, for example, as described here, the function does not work, it simply does not exist

An example of connecting the ngCordova module that works with this plugin:
controller.js
...
angular.module('starter.controllers',[])
  .controller('AppCtrl',['$scope','$ionicModal','$localstorage','$q','$http','$cordovaMedia', function ($scope, $ionicModal, $localstorage, $q, $http,$cordovaMedia) {
...

app.js
...
angular.module('starter', ['ionic','ionic.utils','ngCordova','starter.controllers'])
.run(function($ionicPlatform) {
...

When trying "as usual" in the same phonegap to connect the plugin via config.xml(), it gives an error when the application is launched on the device.
The output of cordova.plugins is empty.
Maybe someone has come across, already reviewed a lot of different resources - I seem to be doing everything right, but "does not take off."

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Popov, 2015-02-12
@Kaaboeld

Apparently the problem is that I tried to run the plugin functions before the deviceready event and therefore the device functions could not be activated. Why there are no such clarifications (did not find?) - this is a separate question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question