I am developing cross platform applications that target Android, iOS, Blackberry and Windows Phone Platforms. I am using Jquery Mobile 1.3.1, jquery 1.9.1 and Phonegap 2.8.0.
I want to be able to pass variables from an Android activity to javascript.
How can I call a javascript function from an activity and also call a method in java from javascript.
I browsed for a solution, but, could not understand the usage of sendJavascript() and loadUrl().
Could someone please help me Understand this. I am new to Android and cannot understand how to get this done.
Thanks in advance.
Solution is: Phonegap plugin.
A Phonegap plugin bridges a bit of functionality between the WebView
powering a Cordova application and the native platform the Cordova
application is running on.
It is well explained with each platform in official phonegap doc.Here you can read more about Android plugin of phonegap.
And here a very nice tutorial on how to Write a PhoneGap 3.0 Plugin for Android .
Related
I am a web developer, recently i have developed a android app using cordova.
But my application is slow, so i deside to developed the same app using andoid no native code. But the challenge is making same gui. i am new in android.
So my question is that what tools i use for gui design, and is there any framework like bootstrap? thanks in advance.
Maybe this might help: http://www.androidbootstrap.com/
Github link: https://github.com/AndroidBootstrap/android-bootstrap
Android app is also a browser app designed in xml, what kind of app you want to build if its an offline app you have design in xml but if it's online app (ex: playstore) you can use WebView it gives you a browser(with your webpage address hard coded in it) within an app and there you can open your mobile website.
Just like other apps do flipcart, jstdial, amazon etc.
Tools: Android Studio is best but for Start download Eclipse Atd bundle its comparatively light later you can switch to Android Studio.
Unfortunately there is no
and
www.androidbootstrap.com/
You have to do all your design in xml resource, where you can use tags like - style, selector, layer-list, item, shape etc. And these resources have to be controlled dynamically using java (in activity).
In Developers documentation of android (provided by Google) you will find details Style elements
I need to generate pulses to create a frequency from my android device (to communicate to arduino via the audio jack, but this is not important). Natively, java allows us to do that as explained here.
Unfortunately this is impossible to do via javascript, so I need to run this native code in my app through Javascript.
I'm a complete ignorant about "running Java from JS", so, can you suggest me a tutorial where to learn from, or help me somehow?
You need to write an Android plugin for this, Phonegap Android Plugin is the phonegap API documentation for writing a plugin. You need to call your Android Plugin through JavaScript.
Here is a Sample PhoneGap plugin for Android
my question is: Is posible to run a native app using a web app developed on phonegap?, I need to make that, I was reading about is necessary create a plugin to connect with other native app, but I'm starting to programming over phonegap I still don't understand much, and need to create that. But I need some very explicit.
Thanks.
Yes, you can create a PhoneGap native plugin that will enable you to create custom functionality in native code, and expose that to your PhoneGap applications via PhoneGap's native-to-JavaScript bridge. For more information about plugins and example of how to implement them check this tutorial:
http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-android.html
I need to know how to use the jquery mobile with java coding in the same application, so I can merge some features not available in the jquery platform to make some advanced android application.
appreciate your responses.
First don't listen personne3000, apparently he never touched Phonegap.
It can be done with jQuery Mobile if you use it with Phonegap. Phonegap, while working as a wrapper for HTML5/JS/CSS will give you access to native JAVA code (Android only of course). Phonegap will give you access to the wide range of mobile phone compatibilities ranging from camera, sound record up to creating native tab bar for your app.
Here you will find a "iOS Getting started" tutorial for Phonegap/Cordova and here's an Android tutorial.
Here you can find basic Phonegap/Cordova API reference and this is just a basic list, much more can be found in 3rd party plugin list here.
In case you can't find functionality you need you can create your own plugin and here you will find a Phonegap plugin tutorial for Android platform. In case you are going to use an older version of Phonegap (pre Cordova) here's an older plugin creation tutorial.
I don't think you can directly use jQuery mobile to develop your app. However, you can :
Develop an Android application using Phonegap or Cordova in HTML5/Javascript, and use jQuery mobile, but you won't have access to Java
Use WebViews to display webpages with Javascript included. You might want to look at the addJavascriptInterface method.
Javascript and Java can't be mixed just like that in an application : they work very differently.
I Have a Java application and I need to convert it to an Android application
is there any resources to show how ? in Android developer site I didnt found anything like that!
I need to use the Java methods and classes in android ,How it can be done?
If you use the standard android SDK (http://developer.android.com/sdk/index.html) all code is already done in JAVA and should already work in android. Just follow the instructions to set up eclipse and android sdk tools and then import your code to an android project.
The only thing that must be changed is the GUI (graphical user interface) since it's different in android. Do the "hello world" tutorial and "Hello, Views" tutorial in the android sdk page that should put you in the right track of how you should do GUI's in android ;)