Getting error while adding phonegap LocalFileSystem plugin - javascript

I'm trying to add LocalFileSystem plugin into my project. But when i execute this command phonegap plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git from '../assets/www/' directory i get this error : JScript runtime error 800A1391 'window' is undefined

I don't think you're in the right directory, you want to be in the root of your Cordova/PhoneGap application (where the config.xml is located). For you, it looks like it might be your /assets/ directory. Also, try this command:
cordova plugin add org.apache.cordova.file
Taken from: http://plugins.cordova.io/#/package/org.apache.cordova.file

Try going to the main folder of your project (The highest level folder) and execute
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git
at the CLI. You also need to configure config.xml and AndroidManifest.xml according to the docs: Phonegap Docs
See phonegap-android-localfilesystem-is-not-defined

I was using phonegap 3.0. I updated phonegap to latest version 3.4 and that solved my problem. The .cordova folder was not present in my project directory.

Related

Whenever I add a new cordova package to Meteor I get "Error: Variable(s) missing: REVERSED_CLIENT_ID"

Building an ios application from an existing Meteor package. I have been running the following in order to get the application to become an Xcode project:
meteor build ../example-output --mobile-settings settings-staging.json --server https://example-staging.meteorapp.com:443
I already have a mobile-config.js, which includes all the typical configurations for meteor such as App.info, App.icons, App.launchScreens, App.appendToConfig. In addition, I have the REVERSED_CLIENT_ID included in the file. Everything works fine, until I add any cordova plugins (meteor add plugin cordova: etc.)
App.configurePlugin("cordova-plugin-googleplus", {
REVERSED_CLIENT_ID: "com.googleusercontent.apps.010101010-bexamples123"
});
The application builds into a .xcworkspace but then has issues which I think these cordova plugins will fix. How can I configure/fix the REVERSED_CLIENT_ID and/or config issues and add cordova plugins so that this project can compile to an Xcode .xcworkspace?
Thanks to this Github post, which pointed out that
"This problem exists since 1.2.x. It sometimes happens if a Cordova
package references another Cordova package as a dependency. I had this
problems a lot with the cordova-plugin-compat package which is
referenced by some others."
The solution ended up being to simply remove the cordova build:
rm -rf .meteor/local/cordova-build
I also removed and added the iOS platform again for good measure:
meteor remove-platform ios
meteor add-platform ios

Error in using AdMob Plugin Pro

I am new to iphone cordova.I want to use AdMob Plugin Pro, so i downloaded the zip file and then copied the .h and .m files to plugin folder and the AdMob.js to js folder inside the www folder.Then registered it in config.xml using the following lines
<plugin name="AdMob" value="AdMob" />
I have included the AdMob.js file in my index.html ,then i called the createBanner function defined in the AdMob.js but it gave me an error saying
ReferenceError: Can't find variable: AdMob adMob plugin
The method which i called is as follows
if(AdMob) {
console.log('entered if babu');
AdMob.createBanner( {
adId: id,
position: AdMob.AD_POSITION.TOP_CENTER,
autoShow: true } );
Can anyone guide me where possibly i am going wrong.
I am the author of the admob plugin pro. The way you are using the plugin is not correct.
Instead of copying the files, please use the cordova command line tool to manage files for you:
[sudo] npm install cordova -g
cordova plugin add cordova-plugin-admobpro
Here are the steps for quickly try the plugin with its sample index.html:
[sudo] npm install plugin-verify -g
plugin-verify cordova-plugin-admobpro
Then you will see the tool is creating a demo project, add the plugin, add ios/android platform, then build and run the app in emulator.
For more details, please check the wiki:
https://github.com/floatinghotpot/cordova-admob-pro/wiki

LiveScript with Meteor.js

I wonder if there is an easy way to get LiveScript files compiled to js in Meteor.js app. Found this mrt extension:
https://atmosphere.meteor.com/package/livescript-latest
But doing mrt add livescript-latest only gives error:
While building package `livescript-latest`:
package.js:3:9: Package.register_extension() is no longer supported. Use Package._transitional_registerBuildPlugin instead.
In the git repo of this extension the error is already fixed. So I can this directly to smart.json:
"livescript-latest": {
"git": "https://github.com/Whoaa512/meteor-livescript.git",
"branch": "master"
}
This seems to be installed fine, but when I try adding .ls files to the project, they are not seems to be compiled.
Anyone else tried LiveScripting with Meteor.js apps?
Try using the other livescript package. I'm not sure why someone created the livescript-latest package - both seem to be using version 1.2.0 of livescript.
mrt add livescript
This worked for me back when I was using LiveScript.
meteor add vasaka:livescript-compiler
https://atmospherejs.com/vasaka/livescript-compiler

Android Phonegap 3.3.0 and Email Composer plugin Uncaught TypeError

I installed phonegap 3.3.0 via the command line, created app, added android platform OK. I can use the latest Android ADT to import phonegap app and test it on my Android device. Everything worked perfect.
I installed the Email Composer plugin https://github.com/katzer/cordova-plugin-email-composer via the command line
cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git
The plugin seems install ok, however when I tried to run the javascript code
window.plugin.email.open();
I got error
Uncaught TypeError: Cannot call method 'open' of undefined:43
I put the email_composer.js inside js folder and in my index.html I add reference to it. Not sure why I get this error.
I already asked the author here https://github.com/katzer/cordova-plugin-email-composer/issues/9 and he answered:
You lead the plugin in the wrong way. Do not lead the plugins directly.
If you install a plugin through the command line interface,
they will be listed in the cordova_plugins.js file which is loaded
by cordova.js.
I looked up the file cordova_plugins.js I only saw these code:
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [];
module.exports.metadata =
// TOP OF METADATA
{}
// BOTTOM OF METADATA
});
I should see something about email_composer.js in this file, right? If so, then what I should write in here.
This is my first time using phonegap plugin, not sure what to do. Hope someone can help
Thanks
Always remember to 'prepare' your app after installing any new plugin. From the app's root:
cordova prepare android
This should update your cordova_plugins.js file
I found the bug. I got error if I call the javascript like this
window.plugin.email.open();
To make it works, call like this:
window.plugin.open();
(remove "email")
Hope this help someone

PhoneGap Email Plugin

I am trying to use the plugin here This is the first time I have started to use Phonegap in Android, so the process is a little unfamiliar to me.
So far I have added the .JAVA file to here "src.org.apache.cordova" I have added the .JS to the www folder and have referenced it in my HTML file.
I have added the following to my config.xml
<plugin name="EmailComposer" value="org.apache.cordova.emailComposer"/>
As the README file does not really go into specifics, I am assuming this is the value that must go in here.
I then use the following in my HTML file.
window.plugins.emailComposer.showEmailComposerWithCallback(null,"Look at this photo","Take a look at <b>this<b/>:",["example#email.com", "johndoe#email.org"],[],[],true,["_complete_path/image.jpg", "_other_complete_path/file.zip"]);
This is straight from the README file, nothing happens when I run the application. Not even an error.
I have tried using various versions in the emulator and on a Samsung S2 running 4.0.3
Phonegap version 2.7
Can anyone point me in the right direction?
Thanks
The mail plugin from katzer works like a charm.
Use cordova plugin add cordova-plugin-email-composer#0.8.3 to add install it locally.
If you are using PhoneGap Build, don't forget to add the following line to the config.xml
<gap:plugin name="cordova-plugin-email-composer" version="0.8.3" source="npm" />
This was simply down to case sensitive values - I changed the following
org.apache.cordova.emailComposer
For
org.apache.cordova.EmailComposer
you need to use this plugin its easy to use with more features available.
latest stable version - cordova plugin add cordova-plugin-email-composer#0.8.3
https://github.com/AppGyver/email-composer/
https://github.com/katzer/cordova-plugin-email-composer

Categories