hello everyone
i want to add ng-cordova plugins to ionic 2 app but i am not able to find any help on this any hep will be appreciated thank you
I wanter to add push notification plugin the docmentation specififed in ionic v2 tutorial is not working
hello everyone
i want to add ng-cordova plugins to ionic 2 app but i am not able to find any help on this any hep will be appreciated thank you
I wanter to add push notification plugin the docmentation specififed in ionic v2 tutorial is not working
fitst
npm install -g ionic@alpha and npm install -g cordova,
then
cordova plugin add https://⦠or ionic plugin add https://ā¦
thank you very much for the reply but i want to intergrate ngcordova first i am not able to install ng-cordova
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.
is it possible to use push notification with ionic 2 currently the example specified in their docs is not working
Hi @joshmorony,
could u please explain little bit more about using plugins listed in ngCordova, but not yet implemented directly in ionic2
Iām trying to implement SocialSharing with ionic2.
Iām basically confused with 2 approaches
E.g. import {Camera} from 'ionic/ionic';
but Iām not sure how to import the SocialSharing plugin as above.
SocialSharing plugin ngCordova implementation , it seems like its usingE.g . $window.plugins.socialsharing
Iām not sure how to get the $window variable with ionic2 and do I need to using any import statements to load the cordova plugin ?
appreciate if you could point me to the right direction.
and Iām defiantly keen to know if @hussainanver52 has found a solution ?
cheers,
Sam
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:
window.plugins.socialsharing.share('Message only')
Just follow the documentation available for the plugin on GitHub, not the ngCordova docs.
Hey @joshmorony, thanks for the answer. Iāll try that. And Iāll read more about cordova as then Iāll have a better understanding
thanks again
cheers
thanks a lot its working fine
can you help me for inifinite scroll with ionic 2
Infinite scroll hasnāt been added to Ionic 2 yet.
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
In short, you can do this:
ionic plugin add cordova-plugin-camera
and then to take a photo:
let options = {
quality: 100,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA,
encodingType: Camera.EncodingType.JPEG,
saveToPhotoAlbum: true
};
navigator.camera.getPicture(
(imagePath) => {
console.log(imagePath);
},
(error) => {
console.log(error);
}, options
);
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)
Wow.
This just works. Thank you so much!
"you just made my day".toUpperCase()
Can you share your code? I got problem to make this plugin work. Please refer to my question here:
Thanks.
I tried the same but ānavigatorā is undefined as well.
Any idea why?
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.
thanx. in my case
ionic build android
Did the job.
The documentation is misleading (ānavigator. was not mentioned thereā).
Fixing it will boost Ionic v2 adoption ![]()
Hi !
iām with a similar problem with iOS, Android works fine.
Iāve installed cordova-sqlite-storage and https://github.com/danwilson/google-analytics-plugin.git.
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!
Someone having a same issue?
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?
yep, google analytics.
now, iāve removed the platform and add again (after multiple times) and the analytics worked.
iām running in a tablet, inspecting with safari, why SQLite still not working?