How to use ace plugin in ionic application? - angularjs

I have added the ace plugin ionic (ionic plugin add cordova-plugin-ace). But i tried to access the
if (ace.platform == "Android")
but its gives me following error:
error:ReferenceError: ace is not defined
when i tried to use:
if (window.ace.platform == "Android")
I am getting this error:
platform is not defined to undefined ace.
please help me how to use ACE plugin in my application?

In vanilla cordova app, we use to invoke the plugin code inside deviceready event listener and in ionic framework platform ready is the equivalent of Cordova deviceready event.
Invoke plugin code inside platform ready which ensures that the cordova and plugins are loaded completely.

Related

How to change the default title in ngCordova dialogs?

Running $cordovaDialogs.confirm('Coming soon...', 'Upcomming feature', 'Ok'); I get an alert with title Index.html in iOS, but with the right message.
Any ideas on how to fix this ?
My dependencies are:
"dependencies": {
"cordova": "^6.2.0",
"ionic": "^1.7.16",
},
"cordovaPlugins": [
"cordova-plugin-dialogs"
],
The $cordovaDialogs is an Angular wrapper for the Cordova plugin for Native Dialogs and falls back onto the regular alert() function if it cannot find or access the Cordova plugin.
I think that your problem may be related to the plugin not being installed plugin. Could you try navigator.notification.confirm instead of $cordovaDialogs.confirm? And make sure that the plugin is installed by checking cordova plugins and using cordova plugin add cordova-plugin-dialogs or ionic plugin add cordova-plugin-dialogs if it is not (do not use both, only use ionic plugin add or cordova plugin add).

Using Cordova FileTransfer in an ionic 2 app

I want to do file uploads in my ionic 2 app.
In my code I have:
var ft = new FileTransfer();
But FileTransfer is not recognised.
I have installed the Cordova file transfer plugin using:
cordova plugin add cordova-plugin-file-transfer
How do I import FileTransfer from the plugin so it is available.
I am using Angular 2 not Typescript.
Ensure to include cordova.js file in your respective html. Also register deviceready event listener and invoke plugin inside the listener.
In case of ionic platform, use platform.ready() which is an equivalent wrapper for deviceready event.
ionic.Platform.ready(function(){ //logic to invoke plugins });

Implementing a Social Sharing in Ionic using cordova plugins

I'm trying to implement social sharing in ionic. I followed this tutorial https://www.thepolyglotdeveloper.com/2014/10/implement-social-media-sharing-ionicframework/
I'm getting the error as
TypeError: Cannot read property 'socialsharing' of undefined
at Object.share (ng-cordova.min.js:9)
at Scope.$scope.shareAnyWhere (shareController.js:10)
at $parseFunctionCall (ionic.bundle.js:21037)
at ionic.bundle.js:53344
at Scope.$get.Scope.$eval (ionic.bundle.js:23093)
at Scope.$get.Scope.$apply (ionic.bundle.js:23192)
at HTMLButtonElement.<anonymous> (ionic.bundle.js:53343)
at HTMLButtonElement.eventHandler (ionic.bundle.js:11706)
at triggerMouseEvent (ionic.bundle.js:2863)
at tapClick (ionic.bundle.js:2852)
I have install the plugins which was mentioned in the tutorial.
First make sure you include ng-cordova before cordova.js. Then take a look at the working example here, try that.
Secondly, Make sure you are doing your tests on a real device or on an emulator, Social sharing plugin is intended for native sharing functionality on the OS you are targeting, it is not intended and it will not work on the browser. If you are on a browser then that is why!
You can use the Ionic CLI to run your tests.
You can make use of window.plugins.socialsharing object and call the functions like shareViaFacebook etc ..this is working for me right now in all my projects.
For more details and full code you can check the video here Social Sharing Plugin: Ionic App

window.plugins.AdMob always undefined in ionic app

I'm trying to include this admob plugin.
I've tried everything, but whatever I do, the window.plugins.AdMob is always undefined.
I checked it on my android device and also on the ios simulator (I know it's not working in the browser).
What I did:
I added the plugin with the following command:
cordova plugin add com.google.cordova.admob
Then I tried following the instructions from the plugin, but also used the code example from here.
But whatever I do, window.plugins.AdMob is always undefined.
I also tried loading it with a 3000ms timeout (because some answers say that the plugin is not initially ready and takes some time).
I really don't have a clue what to try next or what step I missed.
I also tried the google analytics plugin and followed the tutorial here but again, the "analytics" object is undefined. What do I miss here?
Instead of using window.plugins.AdMob, please directly use AdMob, or window.AdMob.
It's defined in the plugin.xml:
<js-module src="www/AdMob.js" name="AdMob">
<clobbers target="window.AdMob" />
</js-module>
The example code you see, is for the old AdMob plugin.
1.install admob phonegap plugin
cordova plugin add https://github.com/admob-google/admob-cordova
init admob plugin
init plugin after deviceready event
admob.initAdmob("admob banner ID","admob interstitial ID");
3.show admob ads
admob.showBanner(admob.BannerSize.BANNER,admob.Position.TOP_APP);//show banner at the top of app
Take a look at this https://github.com/Dharmoslap/ng-cordova. You can use AdMob Pro as well.

How to add Cordova barcodescanner plugin sencha touch2.3

I am initializing cordova in my app which was using touch2.3 and added barcodescanner.js file in app.json and build it successfully using sencha app build native.I loaded .apk file in my android and trying to run,when I hit scanner button it is raising an alert saying cordova/plugin/BarcodeScanner not found.I updated config.xml . How to add custom cordova plugins to new Sencha tocuh2.3?.Please help me on where I was going wrong.Any help would be appreciated.Thank you
Download the repo using GIT or just a ZIP from Github.
Add the plugin to your project (from the root of your project):
go to your cordova or phonegap folder run follwing cmd
cordova plugin add
then run beloows for check
cordova plugin ls
I tried following these instructions without success and let me be more specific:
created sencha 2.3 app called myscan
added Cordova (not Phonegap) with Sencha cordova init
cd to Cordova folder
added the plugin
cordova plugin add https://github.com/wildabeast/BarcodeScanner
5 build the app with sencha app build native
6 created a simple test
Ext.device.Scanner.scan(function(c) {
alert("We got a barcode\nResult: " + c.text + "\nFormat: " + c.format + "\nCancelled: " + c.cancelled)
}, function(c) {
alert("Scanning failed: " + c)
})
I was not surprised to see that Ext.device was not defined as all the example code I could find use the navigator object so I looked at the WildaBeast sample code and changed the call to
Cordova.plugins.barcodeScanner.scan ... Now everything is defined and I trace into the code and seems to make the call into IOS but nothing meaningful results and no callbacks are called.
Now Gigi are you using Sencha Cmd v4.0.1.45
after installed barcode scanner plugin use sencha plugin Ext.ux.mgd.device.Scanner

Resources