I am new to PhoneGap and I am able to implement the basic app with PhoneGap, now to enhance it further, I want to connect PhoneGap with Android Activities, basically what I plan is to call startActivity() method using a javascript function.
I tried Communication between Android Java and Phonegap Javascript?
but I failed to call an activity, causing force close error.
Do help me out, awaiting a reply!
Any Java Native code call be called without using any plugin as following.
Follow The following Steps.
Replace the following code with your existing DroidGap Activity.
Add the custom function in current (this) activity as following.
Now call this function from your HTML/JavaScript code as following.
This will call
customFunctionCalled()inMainActivity.Tested Environment
Eclipse – 3.7.2
Android 2.2 Emulator
PhoneGap – 2.0.0
Please provide your comments here to improve blogs post.
http://phonegapexplorers.blogspot.in/2012/08/call-native-java-code-phonegap-android.html