Android: Getting a String from an android app through a browser call - javascript

I am building a Hybrid application for android which has a String value stored in a variable.
I have the application installed in my mobile, and now I need to fetch the String value (from that hybrid app) through a JavaScript call from a browser (web page opened in the same mobile). How can I achieve this?
Forgive for the abstractness in the question, as I am a newbie to both Android and Web app development.

Answering my own question, hoping it might help anyone later.
After so much of online reading, I've found it is not possible to read values embedded within another app. (Except exposing the variable through an external API as Mr. Michal Hainc pointed out rightly in the comment)

Related

Accessing Google AAID via Mobile Browser (Javascript)

I've been searching online for sometime now and have yet to find a clear answer on this subject.
I would like to access a users Google AAID (Advertising ID) via my website when they access it using a mobile browser. I would think this would be possible with some javascript code but I have yet to find any.
Has anyone had experience with this? And is it possible to do?
Thanks!
Capturing IDFA/GAID from mobiles browsers cannot be done,
Apply this approach in native or hybrid app.
until today PWA also do not support
How to fetch device information from a progressive web app

Sample WebView application source code Android

I'm working on an HTML5 based Android App, and I don't understand how to get WebView working. I was wondering if anyone could point me to a place where I can download the source code for an example application of this so I can modify it for my app, or at least reference it. It needs JavaScript support, and to open links in WebView, instead of in the Browser application, which I heard happens unless you change a setting. It will access local files only, not from the internet, but might later on interface with database systems, so it needs the Internet permission, but I think I understand how to add that. Thank you!
I will suggest you too have a look on Cordova.
You can find everything to start a hybrid android app.

android app to send data to the peripheral through USB

I want to develop an android application to be written in html5 and Javascript which sends a string "001" to the peripheral( connected via USB). I've googled about it and knew that javascript don't have access to the external hardware. As this a part of my project i am having big trouble.
Android App.(javascript) <----USB---> peripheral(receives string 001)
Has somebody already done this or have idea about this?
Expecting some Suggestions and help.
Thank you
(late answer to a valid question)
In a scenario like this, a native application is required to act between the HTML5 part and the peripheral. There have been major changes to USB communication in Android since API 12.
There is plenty of information online, including two samples from the Android Developers group: AdbTest and Missile Launcher.
Of course, firstly you should read the official documentation on the subject here and here.

Windows 8 Metro and Google Analytics

Will it be possible to use the Google Analytics JavaScript library (https://developers.google.com/analytics/devguides/collection/gajs/) for the Windows Metro JavaScript based application to trace views accessed by user?
In general, if a JavaScript library you want to use is on a CDN or a server external to your app, the answer is no, as Windows apps written with HTML/JavaScript cannot load external JavaScript libraries...if you try, a security exception will occur.
Many libraries will work fine if you copy the JS file into your project and run it locally. For example, jQuery works just fine this way. I have not tried the Google Analytics library, so you might just want to test it out and see if it will work with a local copy.
Something else to consider, however, is that unlike a web site, a Windows app written in HTML/JavaScript may occasionally be offline, in which case, a library written with the assumption of network connectivity would likely not work. So in this particular case, you might not get the data that you're hoping for.
Hope that helps.
we tried http://w8ga.codeplex.com/ (w8ga) to work with GA in our win8 js app.
Currently W8GA seems doesn't support html/js. Also I have no idea why developer didn't mension it( it's supports only c#/xaml metro app )
So, we found another way to do it; Look for cobra Tab 's answer at the bottom of this page: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/f81ebbb9-d711-40f1-8a82-9aed44e2d8fe/
And finally, we are waiting Adobe's Omniture sdk:
http://microsite.omniture.com/t2/help/en_US/sc/appmeasurement/winrt/index.html#Developer_Quick_Start
Hope these answers helps...
We're using the free version of markedup in our applications with great success. In addition to simple page views it shows you some app specific numbers like number of installs, exception details, etc.
I'd recommend using the Google Analytics SDK for Windows 8 and Windows Phone. It is built as a WinRT component and therefore supports both JS & Xaml Win8 apps.
Full disclosure: I am the author of this SDK; I built it for my own app and decided to open source it. There are other frameworks out there but AFAIK, none of them support the new GA universal analytics protocol so they only work with older GA properties and don't support all the cool new features GA recently added just for apps.

Calling android native APIs from javascript functions of embedded WebView

I am blackberry developer and I don't have any experience in Android programming.
I am trying to create an android application which will have webview/embedded browser. I will load some web page with some javascripts in embedded browser. There will be some buttons on the page which will call javascript functions. Some of these functions require access to native APIs (eg Camera API). Is it possible to call native api's from javascript functions or access to native code of the app ?
Right now this is possible in blackberry platform using Javascript extension. I'm expecting something similar in Android.
Thank you.
Anyone who is looking for the answer, I've found solution based on #dtanders answer.
Check this out:
http://developer.android.com/guide/webapps/webview.html#BindingJavaScript
Use http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String) to expose Java interfaces to the JavaScript running in the WebView
Well, if you specifically want the Camera API, it can be done. From your JS code, you can call a piece of Java code which will in turn trigger the Camera App, take a picture, return the image's URL, which your Java code can forward it to a JS method.
See:
http://developer.android.com/guide/webapps/index.html
http://developer.android.com/guide/webapps/webview.html
Its a complete shot in the dark on my part but these might have some useful information for you.
Webview not responding to touch events
Does Android support click events in its WebView?
Also don't forget that WebViews have javascript disabled by default you'll need to explicitly set it to true in order to make it work.

Categories

Resources