Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    JavaScript


Call An Android Activity From PhoneGap?

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.

View 1 Replies (Posted: Sep 3 11 at 10:25)

Sponsored Links:

Related Forum Messages For JavaScript category:
Android - Call A Function In A HTML Doc From The Activity?
How can I call a function in a HTML doc that is loaded into a webView with a button that is in my activity? ie: An ImageButton (called: bookBtn) is in the title bar of the activity. When it is pressed/tapped, I need it to fire a function in the webView DOM - It basically loads a new HTML doc into the DOM implementing a slide-in effect.

I found plenty of documentation on how to do this from the webView to the activity but not the other way around. Google says it can be done but there really isnt any examples. I tried to tweek the example code they show here but I cant get it to work. Below is the function w/in the HTML doc that is loaded into the webView, mWebView:


Posted: Apr 1 11 at 2:33

View 3 Replies!   View Related
Call Android Function From Phonegap HTML Page?
i make Android application that can communicate to bluetooth printer for printing some text, now i want to call that android function that i made printText() from my phonegap html file.[code]

Posted: Dec 13 11 at 1:54

View 1 Replies!   View Related
Jquery :: Prevent Freezing PhoneGap App In Android When Doing Asynchronous AJAX Call?
I have PhoneGap-Android app and I am using Jquery. I am doing ASYNCHRONOUS AJAX call and during the call, app just freezes and waits after AJAX call finish ( it is mainly noticeable when on GSM connection ).

I would understand this, if I would be doing synchronous request, but I have:

Posted: May 17 11 at 4:33

View 2 Replies!   View Related
Phonegap - Detecting The Network Activity?
I have made a phonegap 1.0.0 app which loads the current location via Google Map. I have also created a plugin to display the activity indicator on the top of the screen, i.e. on the status bar of the iPhone.

function onBodyLoad()


How to make the activityIndicator start/stop whenever there is any network Activity?

Posted: Nov 3 11 at 10:07

View 1 Replies!   View Related
Difference Between Android Phonegap And Blackberry Phonegap?
what is phonegap.what is the advantages of using phonegap.what is the difference between android phonegap and blackberry phonegap.what is the disadvantages of phonegap.

Posted: Sep 15 11 at 13:56

View 1 Replies!   View Related
Android - Passing Array From Activity
I know there a couple of threads similar to this one but they dont actually answer the above question. Firts question: is it true that only primitives can be passed? (String, boolean,...) Second question: if it is so. I have an array of String in my activiy and i need it to fill a html table in my WebView and apparently i need to use Javascript interface to do so. So the question is: How can i do that? Do I need to create a string in my activity, pass it to JS and once there recreate the array?

Posted: Nov 15 at 15:25

View 1 Replies!   View Related
Pass Array Of Values From Android Activity To Script In A WebView?
I'm using a JS Charts library to draw graphs in a WebView of my Android Application. I want to provide the data from the SQLite database. At this moment I'm stuck on how to pass array of data from Java to JavaScript. The JavaScript part expects something like that:

data = new Array([10, 10], [20, 10]);

I know about the addJavaScriptInterface and I managed to pass single values from my Activity to a WebView. It's only the array that gives me trouble. I thought about something like [code]...

Posted: Dec 2 10 at 2:03

View 1 Replies!   View Related
PhoneGap App Is Unresponsive On Android
I created a simple PhoneGap application that, right now, just takes a picture when you tap a button and then displays the picture in an image on the same page. I've built both iOS and Android versions, and the iOS version works fine. The Android version, on the other hand, highlights the button but never switches to a camera activity. What could be the problem?

My first thought was that the problem is in the Javascript code in my index.html file. So, I completely replaced the contents of my index.html with the "Full Example" from the PhoneGap API Camera reference page. This page displays four buttons, each of which triggers a Javascript function that uses PhoneGap to acquire an image in one way or another. The app builds without errors and starts up on my test device (HTC Evo 4G). Once again, however, tapping any of the buttons causes that button to highlight, but nothing else happens.

I'm using a recently downloaded PhoneGap 0.95, the latest Android SDK (downloaded and installed two days ago), and Eclipse with the ADT plugin.

How to start debugging this?

Edit: For what it's worth, I set up my Android project according to the steps in the PhoneGap Get Started Guide for Android. I modified the AndroidManifest.xml file according to the directions there and using exactly the text from the directions, so the first line after the <supports-screens ... /> block is: <uses-permission android:name="android.permission.CAMERA" />

Posted: May 25 11 at 17:37

View 3 Replies!   View Related
App Icon For Android In Phonegap ?
I have an HTML5/Javascript app, and I have used PhoneGap's build service to generate the APK file for my Android. I successfully installed the APK file on my Android and everything is fine, except that the app icon on the phone is the default Android icon. In PhoneGap Build I uploaded my PNG file to the project under the 'Details' section, and I thought that icon was supposed to be used as your app icon? I've tried several different sizes.

Posted: Nov 22 11 at 17:12

View 1 Replies!   View Related
With reference to the Android class InputType here, and using a system built with phonegap.

How can you use TYPE_TEXT_VARIATION_VISIBLE_PASSWORD with a given input field? Is this possible?

Posted: Apr 15 11 at 6:14

View 1 Replies!   View Related
Access Sms Inbox On Android (phonegap)?
I just discovered phonegap and was wondering if there's a way to acces SMS inbox from javascript with it. Or if there's another easy way to do it in an app created from HTML/CSS/JS solution.

There's no info about SMS access in phonegap docs, but maybe the inbox is avaliable as a url or a folder?

I would like to stick with phonegap so that the app would work on many devices, but android only solution is satisfactory too.

Posted: Dec 22 10 at 8:13

View 1 Replies!   View Related
Phonegap Android Console Log Not Working?
The console log like console.log("Test Text"); is not working android emulator. But it works in iphone semulator. I am using phonegap with html/css/javascript and want to show my debuging information.

Is there any other way to display console in android.

Posted: Sep 17 at 10:13

View 3 Replies!   View Related
Android - Use The PhoneGap Share Plugin?
I am trying to use the PhoneGap Share plugin which is supposed to bring up the native Android "Share" window which allows the user to pick which application to share to.


I have a hyperlink which calls the following code (provided on github).{
subject: 'I like turtles',
text: ''},
function() {}, // Success function
function() {alert('Share failed')} // Failure function

When trying to debug the app on my phone, I get the following error:

Cannot call method 'show' of undefined at file:///android_asset/www/index.html

What do I need to do to get this to work?

Posted: Nov 29 11 at 4:27

View 2 Replies!   View Related
Link To App In Android Market Using Phonegap
I would like to link to a full version of my application using a link in the free version of m application that I have built using phonegap and jquery mobile.

I've tried just putting the URL in an a href tag but this just loads for around 5 seconds then goes to a blank white page.

Am I missing something?

I'm using <a href= [url]

Posted: Oct 13 11 at 11:40

View 1 Replies!   View Related
Fully Closing A Phonegap Android App ?
How do I fully close a phonegap android app? I've try using device.exitApp() as well as and have the same problem with both.

The problem is that I have a html file, index.html, that links to an external html file, main.html. Now if I hit the close button without going to the external file, the app closes just fine. If I go to the external file and then go back to index then hit close, it closes index but brings up main. How do I completely close the app whether or not I go the external page?



Android Manifest

Posted: Sep 14 11 at 22:30

View 1 Replies!   View Related
Capture Screen In Android App Using Phonegap?
I'm asking for suggestions on how you would go about capturing and saving what is currently displayed in an Android application compiled with Phonegap, by pressing a button.

I've done hours and hours of research into possible ways to do this:

Creating a Phonegap plugin that finds the current view, converts it to a bitmap then saves this to the devices SDcard. As seen here.

Uses the HTML5 Canvas tag and converts this and any child elements to a PNG file, using the toDataURL method as seen here.

There are hundreds of SO posts saying this cannot be done in Android, but I can't believe that considering i've found two links that may be possible.

I have tried the links above, however there are some outstanding issues that prevent me from getting them to work. I was looking for alternatives.

Below is the plugin code I am using, together with the code from the first link on how to record a screenshot of a view.

I get a Null Pointer Exception at this line:

View content = findViewById(;

My question would be, does Phonegap create views in Android and if so, how do you select them using the findViewById method?

Posted: Nov 14 11 at 18:03

View 1 Replies!   View Related
JQuery :: Draggable On Phonegap Android
Im having some problem while implementing jQuery Draggable [url] on android. Iv created the html code and tested it using my browser. Then I compiled it on After getting .apk I installed it on my xperia x8 which is using Android 2.2 Froyo. The application ran well, but when i dragged the object it wont move..

Posted: May 19 11 at 4:13

View 3 Replies!   View Related
JQuery :: Using Append On Android Using Phonegap
I'm trying to use JQuery's append method on an android application using phonegap, however it does not seem to work, and in fact causes the page to fail loading. commenting out the append call fixes that...(The page loads just fine when opened in Chrome)

Is this a phonegap or android bug or what? Is there a workaround to get append to work or something similar to append that works?

Posted: Aug 27 11 at 12:55

View 1 Replies!   View Related
Phonegap 1.0 Android Capture Video
I am trying to capture an image and failed!

I use phonegap 1.0 and jquery mobile 1.0b2.

The following line starts the devices internal videorecorder!

navigator.device.capture.captureVideo(captureSuccess, captureError, {limit: 1});code here

The callbacks:

If i quit recording i get back to my app and i get the console log of captureError but with the error.code as "undefined".

If i try to store the video the captureSuccess won't be called and my application restarts!

Posted: Aug 16 11 at 10:26

View 1 Replies!   View Related
Phonegap-Android-SQlite - How To Connect
Im creating project using eclipse in windows xp. m using sqlite database. but i saw the sample code of [url]

But i m not able to execute these example. I m not getting required results. Suppose i want to get the all entries in the table demo in tabular format of html. Wht will the code in index.html? for that what is the procedure and what is step by step procedure for doing this?

Posted: Mar 17 11 at 22:04

View 1 Replies!   View Related
Play Song In Android - Phonegap ?
A month ago I started working with phonegap, html5, css3 and jQtouch. I am working on an application and I need to play sound in the application. I have serious problem with this task.

First I've found out that I can play .mp3 files through phonegap using the new Media(...) function. I am not sure about .wav files, can I play those?

Second I've found that files must be less than 30 sec, is this so?

Third I can find the right place for my sound files. My project structure is the following:

I've tried placing the file in 'www' folder and creating a new one called 'audio'. None of this gave me what I wanted.

I am using this code for executing the song:

I use Android 2.1 Simulator and I've tried 2.2 once again without success.

Posted: Nov 11 10 at 20:46

View 3 Replies!   View Related
Phonegap In Android OnDeviceReady Function ?
I am using phonegap in android development. I wrote that PoC, however I can not figure out why it does not change the latitude of profile variable.

Actually alert(profile.latitude); runs before the geoCode.setLocation();

Here is my code:

Posted: Nov 24 11 at 10:14

View 2 Replies!   View Related
Debug Script In Android Emulator With Phonegap?
I am new to phonegap and android development. May I know how can I debug javascript error on the emulator? I have heard about ADB may I know how can I use and install it on windows 7 system? I have an ajax called with jsonp but no response on emulator. However, I can call that ajax with browser on windows. May I know what went wrong?

Posted: Jan 13 11 at 18:06

View 7 Replies!   View Related
Capturing Back Key Press On PhoneGap For Android
I am using PhoneGap for Android Application development and I'm stuck at capturing the back key press on the device! I tried everything from other threads and from the official wiki page but none seem to work! :(

I could capture menu and search keys with keyEvent.menuTrigger and keyEvent.searchTrigger but can't seem to capture the back button press! I tried keyEvent.backTrigger similarly but it didn't work! Adding event listener for 'backKeyDown' event doesn't work either!

Here's my code:

document.addEventListener('backKeyDown', function(e) {
console.log('Caught it!');
}, false);
keyEvent.searchTrigger= searchPressed;

The console says:

Line 1 : Uncaught TypeError: Cannot call method 'backTrigger' of undefined

Doesn't that mean something.backTrigger() is being called but the object something doesn't exist. What is that something? Or is there any way around?

Posted: Apr 18 at 5:46

View 3 Replies!   View Related
Copyright 2005-08, All rights reserved