PhoneGap - inappBrowser pluggin install/include - javascript

I know there are a number of posts on how to use the functions of the cordova inapp browser pluggin and that's great. But I am having trouble installing or including the pluggin in my app when I upload it to PhoneGap Build.
When I include:
plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser"
PhoneGap Build tells me that the pluggin is not supported...
I've also tried including the .git file but I couldn't get that working either.
Im sure im just mistyping something or missing some step. Please help!!
All I need I'm sure is the correct plugin tag to use in my config file so if someone could just paste it in this thread that would be outstanding.

So the issue I was having was because I did not install phonegap CLI before attempting to install the plugin. stupid me.... but I did it and got it working now! thanks for everyones input...

Phonegap Build has dropped support for the old method of installing plugins. You now have to use NPM as the source.
Putting this in your config.xml should make it work on Phonegap Build:
<plugin name="cordova-plugin-inappbrowser" source="npm" />

Related

ngCordova Plugins - Issue getting cordova.js included properly

I've been trying everything for the past two days to solve this issue. I'm well and truly stumped. Perhaps someone with greater knowledge than I can shed some light on the issue:
Basically, I'm building an app in AngularJS with the purpose of building Android and iOS apps from it using Cordova. I should specify that I am using cordova-cli on Linux and ngCordova (wrapper around plugins). I am NOT using Ionic Framework.
My app works fine in Chrome. I followed the ngCordova installation guide perfectly: http://ngcordova.com/docs/install/
I used bower to install. Then included the following in the index.html of my Web App project (not the Cordova project):
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
It didn't work. I thought maybe it's because the ng-cordova.js went into my bower components directory. So I changed that script tag to:
bower_components/ngCordova/dist/ng-cordova.js
When I go to my cordova project directory and set up the platforms, plugins etc... and run:
cordova build android
followed by
cordova run android
The app runs on my device (Nexus 5). I use chrome://inspect to see what happens when I click the button which should be using the email composer plugin: I get a cordova not defined error.
I went into the controller and put this in
console.log($cordovaEmailComposer);
I can examine this in chrome://insepct and it has all the correct functions etc.. so ng-cordova.js is running fine (thats where the factory for the plugin is).
I'm 99% sure the issue is that somewhere along the line cordova.js is being lost. When I go into the cordova project in the ProjectName/www/index.html the tag for cordova.js is commented out.
Same in the platforms/android/assets/www/index.html file.
I traced it back and the same is true in WebAppProject/dist/index.html file. It's commented out. So it seems that when I run grunt build cordova.js is being removed. I thought maybe it's because cordova.js wasn't in the WebAppProject so I brought it into the root directory (same locations as index.html) and it still happened.
Can anyone explain how to properly get this working? I'm totally at a loss. I've tried a million different ways of including cordova.js. I even manually uncommented it out in the cordovaproject/www/index.html. The app builds but crashs upon opening (white screen then dies) suggesting a missing script (despite cordova.js being n that directory too...).
Is this the grunt build process? Or am I totally setting up an ngCordova project incorrectly without realising... I would post some code but I'm 99% sure the issue is with cordova.js or the way the project is building upon either grunt build or cordova build.
Any help would be much appreciated. :)
Cheers,
D
Make sure to include ngCordova before cordova.js and after angular.js.
<script src="/path/to/angular.js"></script>
<script src="/path/to/ng-cordova.js"></script>
<script src="/path/to/cordova.js"></script>

Phonegap build does not work

I have tried to build my app on Phonegap with plugin and got error for Android:
"Error - Some official plugins have to be updated if using PhoneGap >= 4.0.0. Please upgrade the version of any plugins that may include the following file: LocalNotification.java".
So i changed the source for plugin from:
<plugin name="de.appplant.cordova.plugin.local-notification" source="pgb"/>
to:
<plugin name="de.appplant.cordova.plugin.local-notification" source="npm" />
and now i get error for IOS build that says:
"Error - The following plugin, plugin version or a dependancy of this plugin is not on npm: de.appplant.cordova.plugin.local-notification"
So when i use one source i have build for Android but don't have for IOS, and other source allowes me to build IOS but not Android. Also if i don't set the version, it should use the latest one, making my first error message unclear to me.
What should i do?
Double check the version of phonegap you maybe using.
If you are using the remote build process here and have an old version of phonegap running then your problem maybe that your plugins are configured for a local build not a remote one.
Basically, this:
<plugin name="de.appplant.cordova.plugin.local-notification" source="npm" />
is actually this:
<gap:plugin name="de.appplant.cordova.plugin.local-notification" source="npm" />
with older versions of phonegap. More info here.
Your options maybe to upgrade to a newer version of phonegap or change the plugin declarations as I have shown above.

Phonegap Build plugin not recognised, js not loading

I've been tasked with learning how to build Phonegap Apps through AEM 6.0. So far i managed to create an empty starting point app and get some features fro the ootb geometrixx app back in.
Now i've been trying to add the phonegap camera plugin without success.
I've added the required line to our config.xml:
<gap:plugin name="org.apache.cordova.camera" version="0.3.2" />
and to our installPlugins js that's called as a before_platforms_add cordova hook.
I've checked CLI build and the contents of the apk we're getting from phonegap build and all the files that should be present are present. However I'm still getting File Not Found errors on the js files and a Plugin Does Not Exist Cordova error.
screenshot link for browser console & file structure of apk
Googling hasn't gotten me any real pointers so far, perhaps somebody here can help me out?
After after even more searching and delving into the apk provided by Phonegap Build, a solution has turned up:
As it turns out, there was a third place where the loading of the js files was controlled, namely the contentsync-file-list.js.jsp file located in the splash page component.
Somehow, although the files were present in the phonegap builds and known to cordova, the list of a plugin's js files not being included in the contentsync-file-list.js.jsp prevents them from actually being loaded by the app.

phonegap build cordova.file is undefined

I am trying to build phonegap app using File plugin, it works fine on local , but when building it using Phonegap build , the plugin does not work, error is
"cordova.file" is undefined
here is my config
<gap:plugin name="org.apache.cordova.file" />
I removed (verion number=1.0.1) as adviced by other questions
Also phonegap build says: "This app isn't using the latest version of PhoneGap. We recommend upgrading to 3.6.3."
Any help would be appreciated
Thanks
Look docs:
Add the following to your config.xml to use version 1.0.1 of this plugin (recommended)::
<gap:plugin name="org.apache.cordova.file" version="1.0.1" />
You can also omit the version tag to always use the most recent version of this plugin. Note that this will result in your app being automatically updated with new versions of this plugin as they are released, and may result in unexpected behaviour.
This is why you can run your app locally that not doing update automatically, however when make build, then it always try to update to the latest plugin version but your PhoneGap platform still with plugin 1.0.1 version, then undefined happen.
So to remove version tag, you should garantee your current plugin version is latest
Phonegap has problem with file plugin new features in versions later than 1.0.1
so I worked around this by including the Javascript files in the pages
thanks

Cordova and Ionic: plugin not updating

I have a question concerning plugins. I am using the ionic framework (http://ionicframework.com/) and Cordova for my hybrid app. I am using
a toast (text popup) plugin to provide some feedback. Everything works but
I decided that I needed some customization so I edited some of the .java files.
It seems that my edit has no impact, it's really strange, the plugin also seems to keep
working even when I comment out the execute function.
I am using the following ionic command to test the app on my smartphone: "ionic run android"
Any idea why the plugin is not updating? Thanks in advance!
I had issues with plugins as well and decided to remove/add them back in, then update platform and it worked.
cordova plugin rm org.apache.cordova.<plugin>
cordova plugin add org.apache.cordova.<plugin>
cordova platform update <platform>
When I remove my android platform and install it back it works (it seems the only place where it installs plugins)

Categories

Resources