phonegap 1.7.0 plugins android not working - javascript

I'm programming an android app using Applicationcraft, but then I need to create my own plugin for a certain requirement. So I downloaded my app from applicationcraft, then compile it manual using phonegap 1.7.0, but I'm having a problem with my plugin. I have followed every steps in this tutorial, but whenever I use my plugin in a test device I always get this error:
Cannot call method "myfunction" of undefined.
Function: callingFunction
I also consult another question here, but I still having the same problem.
Can anybody tell me what are the possible solutions? Or point me to the right direction (any tutorial for making plugin for PhoneGap 1.7.0). Thanks.

No need, I've already found it here.

Related

all cordova plugins give undefined error

I am working on a cordova android app. I am trying to implement push notifications. I tried so many ways using ngcordova, using normal plugin and some other methods all tries give me pushNotification undefined error. But the plugins are being installed without any error.
Then I followed this tutorial and did exactly the same, but it gives
device is not defined
error in the console. I used ripple emulator to test this. I installed it in the phone too, But the same error. I am using angularjs inside. and using cordova version 5.2.0. can anyone point me in a direction, I am really trying hard for the past 4 days but no luck. Please help me.
update
I have correct setup of angular and cordova I believe, because I already built an version of my app with the same setup and pc, and released it in play store. This problems arise only if I add some plugins like push, device, etc. In app browser and splash screen plugins are working fine though.
Make sure to include cordova.js, but it need to be load after angular.js.
If you want, here's a working seed:
https://github.com/marioaleogolsat/cordova-angular-angularMaterial-seed
Just remember that some plugins can't be used in a emulation, so use cordova run --device to make sure that anything is working properly.
Hi It seems you have not done set up of Angular JS and Cordova properly.
Before doing push notifications. You must be ready with Angular JS and Cordova setup.
See below link:
Angular JS and Cordova setup
Follow above link and if it's done try to set up again push notifications.
Hope it helps you.
If Cordova is undefined you probably don't have it referenced in your index page. make sure you have this line.
<!-- Cordova reference, this is added to your app when it's built. -->
<script src="cordova.js"></script>

Check if a URL scheme is registered on iOS or Android in Cordova

I want to check if a particular app is installed and if it is installed, invoke it.
AFAIK, the way to do it is to check if the custom url scheme of the app is registered and use that url to launch the app.
Is there a way for me to do this in my Cordova app?
To be very specific I want to check if the Google Maps application is installed on iOS and if it is, launch it with its custom url else show the default Apple maps.
This url : https://developers.google.com/maps/documentation/ios/urlscheme : shows how to do it in Objective-C, but how do I do it in Javascript in my Cordova app?
I could not find any plugin to achieve the same. Other questions on SO deal with either doing this from a native app or JS on a regular website (in the browser). The most common work-around is to try launching and use a timeout to see if the app launch failed and still my app is running. This is pretty unclean. Access to the iOS API canOpenURL through JS would be best.
Hints?
Cordova does not ship with this feature. There is a plugin which implements it for iOS, though.
https://github.com/philbot5000/CanOpen
I did not find anything for Android yet, but I do not think this would be hard to do in native Android Code. Even if you are not proficient with Objective-C or Java and never intend to write fully native apps, you should learn some basics if you want to build apps with Cordova.
Small and simple plugins are really easy to do. Read the docs and have a look at the code of some simple plugins to see how it is done. For example the source code of the one above or of the one below is really simple and straightforward to understand:
https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin

Phonegap push notification with parse.com

Im looking for a way to implement push notification on a phonegap application using javascript and parse.com. I found this turorial for iOS
http://www.ladeezfirstmedia.com/2013/08/01/tutorial-part-5-push-it-real-good-with-push-notifications-using-corona-sdk-and-parse-com/
, which seems pretty straight forward, and this tutorial for android http://www.raymondcamden.com/index.cfm/2012/10/10/PhoneGap-Parsecom-and-Push-Notifications.
However, Im using cordova 3.3. and rather stay away from editing the AndroidManifest, which I need to do in the last tutorial. Can any one point me in the right direction, maybe to a tutorial where I can use cordova plugin and easily combine it with parse.com by using javascript for both iO and Android? Btw Im building my project locally in the terminal.
What I want is to notify the user, when its their turn in a game.
Have a look at this answer I've just posted, I've just got the Android Parse PNs working:
How do I get Parse.com Push Notifications working in a Cordova/Phonegap Android app?
It does require you to modify the AndroidManifest and some of the Java files as well, but not a lot. I can't find a plugin that works without doing some of the work myself.
You can use the plugin for iOS as well, you don't need to edit any of the iOS source code but will need to generate a certificate for iOS push notifications, as documented on Parse.
https://parse.com/tutorials/ios-push-notifications

Android Game on javascript

I want to create a truth or dare game for android. I am actually thinking about a UI which will have a bottle which can be rotate when user allow it to.
my question is can i do it in android javascript ?
because i know js little bit and there might be some code available online related to my work.
any suggestion or code related will be appreciated
Thanks
Also can i use javascript libraries like jquery on android ?
using phonegap for developing might help you with your project. and yes phonegap does support jquery for android development.

Automatic tests for phonegap plugins

I recently wrote a phonegap plugin for Android and iOS (javascript calls native java or objc code and returns results via callback functions in javascript), is there anyway to have automatic testing for it (think ant, maven)? I currently have some asyncTests() using QUnit, but you have to manually see the app running either in the emulator/simulator or on a real device to see if the tests passed.
hej,
im dealing with this problem too. right now I ve found something like this http://wiki.phonegap.com/w/page/36886195/Automated%20TestCases%20for%20PhoneGap and
http://groups.google.com/group/phonegap/browse_thread/thread/723039be2c9df90e
so this may help ;]

Categories