GithubHelp home page GithubHelp logo

cordova-plugin-hello's Introduction

Cordova Hello World Plugin

Simple plugin that returns your string prefixed with hello.

Greeting a user with "Hello, world" is something that could be done in JavaScript. This plugin provides a simple example demonstrating how Cordova plugins work.

Using

Create a new Cordova Project

$ cordova create hello com.example.helloapp Hello

Install the plugin

$ cd hello
$ cordova plugin add https://github.com/don/cordova-plugin-hello.git

Edit www/js/index.js and add the following code inside onDeviceReady

    var success = function(message) {
        alert(message);
    }

    var failure = function() {
        alert("Error calling Hello Plugin");
    }

    hello.greet("World", success, failure);

Install iOS or Android platform

cordova platform add ios
cordova platform add android

Run the code

cordova run 

More Info

For more information on setting up Cordova see the documentation

For more info on plugins see the Plugin Development Guide

cordova-plugin-hello's People

Contributors

angelskieglazki avatar dflourusso avatar don avatar edewit avatar jamesingham avatar kellycampbell avatar landreussi avatar marceloboth avatar partus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-hello's Issues

How can I get multiple responses for one request?

In my application, I called this method
hello.greet("World", success, failure);
So I get only one response from the native, even I added a for loop to send multiple responses on iOS side.
for (int i = 0; i <=5; i++) { [self.commandDelegate sendPluginResult:result callbackId:callbackId]; }

Uncaught ReferenceError: hello is not defined

I followed the instructions but I'am getting:

file:///data/data/com.adobe.phonegap.app/files/files/phonegapdevapp/www/js/index.js:45
Uncaught ReferenceError: hello is not defined

at

hello.greet("World", success, failure);

Phonegap: 5.1.1-0.29.0 (cordova: 5.1.1 )
Android: 4.3
I use Phonegap Developer App and www.jsconsole.com to debug.

can you improve a jni example?

your example had help me create a custom plugin few days ago, thanks. I think it's very useful.

but it's not enough for me, I need a JNI example, that would be great for me. Thanks in advance.

Error

Error: Failed to fetch plugin https://github.com/don/cordova-plugin-hello.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 235 Error output:
npm ERR! addLocal Could not install /var/folders/7c/f11qll2s2sn3sbn77m6jmxj40000gn/T/npm-4881-9c5627f7/git-cache-485b75f0/d88f773deba3123b0a041da005972f9908f7f152
npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "https://github.com/don/cordova-plugin-hello.git" "--save"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

iOS build failed with latest cordova

llo.m:16:11: error:
no visible @interface for 'HWPHello' declares the selector 'success:callbackId:'
[self success:result callbackId:callbackId];
~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

** BUILD FAILED **

How to use cordova plugin in our cordova project?

Hi All.

I've install freshly new blank cordova project to test this plugin. Then i've just follow the step that has written in readme.md
But i still didnt know whether this plugin is working or not in my cordova project.

Here's my index.js code :

var app = {
initialize: function() {
this.bindEvents();
},

bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
},

onDeviceReady: function() {
    var success = function(message) {
        alert(message);
    }
    var failure = function() {
        alert("Error calling Hello Plugin");
    }
    hello.greet("World", success, failure);

    app.receivedEvent('deviceready');
},

receivedEvent: function(id) {
    var parentElement = document.getElementById(id);
    var listeningElement = parentElement.querySelector('.listening');
    var receivedElement = parentElement.querySelector('.received');
    listeningElement.setAttribute('style', 'display:none;');
    receivedElement.setAttribute('style', 'display:block;');
    console.log('Received Event: ' + id);
}

};
app.initialize();

I run/simulate it using evothings studio.

Any clue?

Thanks.

HWPHello.m IOS code return wrong

Rather than

[self success:result callbackId:callbackId];

I needed this for it to work
[self.commandDelegate sendPluginResult:result callbackId:callbackId];

Anthony

License?

This repository seems to be meant for public free usage, but under which license terms?

Updating the repo with a LICENSE file that contains the wanted license terms would be the optimal solution!

Memory growing and growing

HI,

I have tried to use your plugin on ios with a "setInterval" to execute every 1 sec.

Every time the " hello.greet("World", success, failure);"" is executed, the memory usage grows and grows and after about 15 minutes the app crashes with a memory error.

Thanks allot

Avi

alert not firing

Hi

I have an empty project with the default plugins ... i installed this plugin and added the call on index.js on the deviceready event but with very little luck :(
any idea what i coud be missing?

var app = {
    initialize: function() {
        this.bindEvents();
    },
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        var success = function(message) {
            alert(message);
        }

        var failure = function() {
            alert("Error calling Hello Plugin");
        }
        alert('b');
        window.hello.greet("World", success, failure);

        console.log('Received Event: ' + id);
    }
};

btw i did not change config.xml it is in the root folder outside the www folder

thanks

not working in iOS now

hi i am use this plugin on iOS but it won't work in only iOS ,,,, but its work in android...... please help me to solve that.. bcz i need to create one custom plugin... i already use this plugin before 1 month ago at that time its worked but now its not fine in iOS... please check and tell

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.