I actually just had a chat to Mike Hartington about this - ngCordova wonāt be used in Ionic 2. Youāve probably noticed some plugin interfaces provided directly in Ionic 2 already (like Geolocation, Camera etc.) - Ionic will provide interfaces for all the core plugins, but for any others you will just need to create and import your own class (or use one created by the community, which Iām sure there will be plenty of as time goes on).
If thatās not something you feel comfortable doing, of course you can still just use the plugin directly without the promise / ngCordova style structure.
For any plugins that havenāt been implemented in Ionic 2 yet, you can just use it as you would in any Cordova application (without the ngCordova / Ionic 2 style promises which make it a little nicer to implement).
In the case of the social sharing plugin, just install the plugin in your project and trigger it in your code like this:
Hi all, any chance someone got the Camera plugin to work? As i have understood, these plugins are temporarily moved out from the ionic2, and are to be moved back sometime, right? I have had much joy from blogpost written by @joshmorony and others, and almost broke the internet in googling for a viable approach of getting the Camera plugin to work, to no avail. Iāve installed it in the project, but it doesnāt seem to be available as an import {Camera } from āionic/ionicā?
Running latest cordova and ionic. Got the network and geolocation plugins running without problems. takePhoto() { this.platform.ready().then(() => { Camera.getPicture({ }).then(data => { alert('Data', data); }, err => { alert('Unable to take picture') }) } }
Nothing happens, āCameraā is undefined
The alerts as debug is because iām on a chromebook with crouton, and i have not been able to get the android emulator running, so iām building .apk:s for debuggingā¦ A little tedious.
The Camera plugin hasnāt been āremovedā from Ionic 2, the interface for it has been (all plugins have). We will likely see something added in the future (they are working on something called Ionic native), but that doesnāt mean you canāt use Cordova plugins now.
Cordova plugins can be added to any project, itās not specific to Ionic, and in general when you add a plugin it is just made available as a global object in your app. To use it you just need to follow the documentation here: https://github.com/apache/cordova-plugin-camera
Iām using the ES6 fat arrow functions here, but you can just use normal function callbacks if you want (which is what is used in the camera plugin docs)
I did some tests. After you add any plugin, you have to run something like ionic build ios to make it work. Otherwise it always shows āis undefinedā error.
using like this:
this.storage = new Storage(SqlStorage);
platform.ready().then(() => {
window.analytics.startTrackerWithId(āUA-62380044-1ā);
console.log(ādevice.uuidā, device.uuid);
window.analytics.setUserId(device.uuid);
window.analytics.enableUncaughtExceptionReporting(true, function(s){console.log(s)}, function(e){console.error(e)});
});
looks like not installed:
undefined is not an object (evaluating āwindow.analytics.startTrackerWithIdā)
Storage: SQLite plugin not installed, falling back to WebSQL. Make sure to install cordova-sqlite-storage in production!
In your case the error is in the analytics plugin, SqLite is installed but in browser doesnāt exist so it fall back to WebSql.
Which analytics is that? google analytics?