PhoneGap Email Plugin - javascript

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

Related

Custom script in electorn builder?

I'm working on an Electron application and am using electron-builder to generate a windows installer and dmg for mac.
Everything works great, I was able to set up auto update and use other features of electron-builder.
Now I need to include other files that are not part of my electron project and execute them in order to install them during the installation process (on windows).
From the electron builder docs (https://github.com/electron-userland/electron-builder/wiki/Options#NsisOptions) I found out that a custom script can be used (NSIS, which I'll have to learn). I've tried including a test script but nothing seems to happen, has anyone here tried this?
The docs don't seem detailed enough in that regard so it's been very confusing.
Thanks a lot in advance!
So after looking at different places I found out that setting win.target to nsis and perMachine to true will generate the NSIS installer.
It does work, but then sadly there are no auto updates.

Ionic splash screen will not show in Android on brand new project

I've been unable to get splash screens working on new Ionic projects. Here are the steps that I've taken:
ionic start testApp
cd testApp
ionic platform add android
ionic run android
The app works just fine, but the splash screen WILL NOT show up. Everything appears to run fine aside from a handful of warnings in the build, I'm not sure if they're related:
:CordovaLib:compileDebugJavaWithJavacNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:compileDebugJavaWithJavacNote: /Users/jordancooperman/code/testApp/platforms/android/src/org/apache/cordova/splashscreen/SplashScreen.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
I've tried many permutations inside of config.xml, including:
Changing the source file/directory names to match the destination file/directory names.
Using both 'screen' and 'splash' for values in the SplashScreen preference, i.e. <preference name="SplashScreen" value="screen"/>
I've gotten this working in the past when using only Cordova, but using Ionic now it seems to breaking. I'm wondering if it's something with my plugin versions not playing nicely together? See versions here:
cordova-plugin-console 1.0.2 "Console"
cordova-plugin-device 1.1.1 "Device"
cordova-plugin-splashscreen 3.1.0 "Splashscreen"
cordova-plugin-statusbar 2.1.2 "StatusBar"
cordova-plugin-whitelist 1.2.1 "Whitelist"
ionic-plugin-keyboard 1.0.8 "Keyboard"
It all seems pretty cut an dry. I've looked at a ton of SO and Ionic posts about the problem, and none of the proposed solutions have worked. I'm out of ideas, banging my head against a wall after hours of tinkering. Any help is greatly appreciated!
It happened to me yesterday, I solved changing my config.xml to this:
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000"/>
Thanks #刘文壮 for your response. Although I do not know the true cause of the problem, reverting to version cordova-plugin-splashscreen#2.0 did fix the problem.
I had the same issue, solved it by running cordova plugin add cordova-plugin-splashscreen in the project's root folder.
It will install the splashscreen plugin for cordova. I thought Ionic was shipped with it already, so installing it again seems weird but it worked ...

cordova app stopped working after node and/or cordova update

I recently updated node.js and installed the latest version of cordova at the same time. In doing so I have some issues that I did not have before.
It says phonegap.js is depreciated and I need to replace it with cordova.js or plugins may not load
whitelist plugin warnings have started showing up:"No Content-Security-Policy meta tag found. Please add one when using the Cordova-plugin-whitelist plugin."
My plugins aren't loading on start up, but do on resuming.
The plugins is the only real issue, but I just wanted to list everything encase it gave a clue as to a solution. I have been trying for over a week to fix the plugins issue with no success. I can't just revert to the previous version as I don't know what it was.
Any ideas on possible solutions or suggestions as to what version I was likely to be using in order to have these issues now?
#Marty,
this is a common problem. You need to set your compiler to build version 3.7.0 or earlier. If you do not set the version when you build, you will get the latest version, and you get the issues you see. You can set this version on the command line when building an App from scratch.
You need to do the same with your plugins. You need to set the version with them also.
Since you are doing all this work, you may want to start adding the white-list plugin. It will be required after 4.0.0 to use the web.
In addition, you will want to start a move to NPM as the source of your plugins.
This FAQ will help
Top Mistakes by Developers new to Cordova/Phonegap
Read
#6 - Not setting the "phonegap version" for your compiler
#7 - Not setting "version" for you plugins
#10 - Not adding the new "white-list" and "white-list plugin" parameters in config.xml.
#11 - You need to get your plugins from NPM now.

IONIC Error with Cordova file-transfer plugin

I am using the following version of IONIC and Cordova;
IONIC;
1.5.5
Cordova;
5.1.1
Build my mobile application.
But when ever I finish building it and run it I keep getting the following exception:
Uncaught module cordova-plugin-file.ProgressEvent not found
Could someone please help me out ?.
I had the same issue today and in my case this was because the version of the file-transfer plugin was not compatible with the File plugin I use.
The file transfer plugin requires the cordova-plugin-file.ProgressEvent (see FileTransfer.js in the file transfer plugin directory)
But if you're still using an older version of the file plugin (in my case org.apache.cordova.file instead of cordova-plugin-file) then it can't resolve that.
So either you update your plugins so you use the cordova-file-plugin or you change the code of the FileTransfer plugin, this is not advised because when the plugins are reinstalled you will loose this change. But if for whatever reason you can't use the newer file plugin you can use this method.
On line 25 of the FileTransfer.js file change
ProgressEvent = require('cordova-plugin-file.ProgressEvent');
to
ProgressEvent = require('org.apache.cordova.file.ProgressEvent');
If that doesn't solve it, try to look up the correct module name in your File plugin directory's config.xml file (look for the ID property) and use that instead (don't forget to append ProgressEvent)
To elaborate on my point of not changing the code of the FileTransfer plugin you can however copy the plugin code and put it somewhere on your disk and use that plugin instead of the hosted one (which is loaded and used if you just use the plugin's ID)

Getting error while adding phonegap LocalFileSystem plugin

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.

Categories