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).
Related
I'm struggling with cordova plugins in my ionic app. Been googling whole day, no big win yet.
here's what I'm trying to do - open a web page inside my app with navbar present. I found that cordova-themeable might work that out
...however...
I installed it
$ cordova plugin add cordova-plugin-themeablebrowser
ok, it's present
$ cordova plugin list
cordova-plugin-camera 2.2.0 "Camera"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.3 "Console"
cordova-plugin-device 1.1.2 "Device"
cordova-plugin-splashscreen 3.2.2 "Splashscreen"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-themeablebrowser 0.2.15 "ThemeableBrowser"
cordova-plugin-whitelist 1.2.2 "Whitelist"
ionic-plugin-keyboard 2.2.0 "Keyboard"
now, I'm trying to use it in controller function
$scope.doStuff = function doStuff() {
cordova.ThemeableBrowser.open('http://apache.org', '_blank', {
...
and call it in my .html file
<ion-item ng-click="doStuff()">
I get the following error
ReferenceError: cordova is not defined at Scope.doStuff
in my index.html, I've got
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<script src="js/app.js"></script>
please help, thanks
Can you verify the plugin is in your config.xml?
It should look something like this:
<plugin name="com.phonegap.plugins.example">
<param name="APIKey" value="12345678" />
<param name="APISecret" value="12345678" />
</plugin>
would have added this as a comment, but not enough rep and only posting as i cant see any mention of any of this.
make sure it is injected properly into your app, given the error or cordova not defined i'm assuming this might be an issue. i couldnt find any specifc references to it, but considering it is built on top of the inappbrowser, i would assume the DI would be $cordovaInAppBrowserProvider.
while reading the docs, from their gitgub FAQ "I just installed this plugin, how come it just shows a blank toolbar?
The purpose of this plugin is to allow you to style the in app browser the way you want. Isn't that why you installed this plugin in the first place? Hence, it does not come with any defaults. Every UI element needs to be styled by you, otherwise it's hidden. This also avoids polluting your resouce bundle with default images."
To add a plugin you are doing right, i.e. if you want to use cordova adomb plugin:
cordova plugin add cordova-admob
Regarding to the error: Are you debugging in browser or in real device? Normally in browser, you should use
cordova platform add browser
phonegap serve
(I recommend you to use phonegap serve insetad of cordova serve as sometimes it works better, but shouldn't make the difference)
Another way to debug apps is to use android remote debug.
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.
I'm using cordova-http plugin in a Steroids app. according to manual, I've added plugin in iOS config in steroids could service:
[
{"source":"https://github.com/wymsee/cordova-HTTP.git"}
]
and also I've added it in config.xml:
<js-module src="www/cordovaHTTP.js" name="cordova-HTTP">
<clobbers target="cordova-HTTP" />
</js-module>
but still I got the error telling me injected Angular model is missing.
do I need to link it to index.html knowing that manual says
<js-module> fulfills this job.
do I need to install plugin like what's mentioned in plugin's github
page:
cordova plugin add https://github.com/wymsee/cordova-HTTP.git
may you please tell me what should I do step by step to make it
work?
There are many ways to add plugins. There's an easy way:
open your command line
path/to/your/project/plugins
cordova plugin add https://github.com/wymsee/cordova-HTTP.git
Inject the plugins by adding 'cordovaHTTP'
Example: var app = angular.module('myApp', ['ngRoute', 'ngAnimate', 'cordovaHTTP']);
Use it with key word cordovaHTTP
Hopes it'll help you
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.
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