Display offline html in android app with a tablet - android

I have to create an android app, that displays an offline html website. Does android sdk have an internal browser control? What kind of dev sw do you recommend to create this basic wrapper?

Read about WebView.
It's built-in webrowser engine and you can use it to your target.

Yes. WebView
http://developer.android.com/reference/android/webkit/WebView.html
This component allows you to specific a local url (file://) if required or even passed the complete html to the load method. Also capable of event handling for more advanced scenarios.

Related

Android Questions about Mozilla GeckoView

I am a beginner Android developer.
I using the 'WebView' had tried to make a Android App.
However, the speed of the web is too slow.
So the Internet search results found GeckoView.
But homepage has been difficult for me to understand I do not know English well.
My questions:
Can I use GeckoView instead of the WebView? Is it simple?
Can I use a code library that just adds to the 'build.gradle' in Android Studio?
Is there another altenative?
Yes, you can use GeckoView also....
Android WebView is not intended for building browser application because, many advanced Web API'S are disabled.
And different phones might have different versions of WebView all of which your app has to support....
Geckoview is open source library that allows you to render web content on Android using the Gecko web engine...
I made simple application with webview, just check out you'll get some help
https://github.com/malikhimani21/Project-2
In some cases, a WebView is a good option for displaying trusted first-party access to your web pages from either a browser or your own app
check out this link
https://developer.android.com/guide/webapps
Gecko view is only experimental. You can't use for production
https://wiki.mozilla.org/Mobile/GeckoView
So your only choice would be a webview. If you are great in javascript, I would recommend you to use react-native. This is how facebook is made, and you can follow extensive documents mentioned here.
https://facebook.github.io/react-native/

Chrome for Android content access from external app

Is there any way to read page content (html source or DOM) from the active Chrome tab on Android devices?
Chrome for Android doesn't support extensions and there is no plans to implement Extension API on Chrome for Android in the nearest future (however, Chrome for iOS now supports App Extensions).
Some apps (for example, LastPass) can access web content inside web browser.
How can I get read access to the active web page? Are there any external Chrome APIs or something similar?
Any suggestion will be appreciated. Thanks in advance.
It seems to be possible with Android Accessibility. I think the flag you need is FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY, so you can inject JavaScript into the website.
As you can see in this blog by lastbpass, they use the same approach. In the video at 0:53, you see the accessibility features they use.

A web based phone app with online and local html files

Hello i am working on a mobile magento theme. What i am looking is to embed or either cache the html, css and javascript files (do not know which is better!) to the application (local storage on phone) and retrieve the product catalog and related pictures from the database and online servers
My intention is to make the app have minimum load on startup and shows as normal native apps
Can you give some guidelines and routine to do so .
Thanks you.
You can either give PhoneGap a shot (http://www.phonegap.com), or try it yourself, since PhoneGap is nothing more than some small libraries to make native function (notifications, vibrating etc.) available for JavaScript calls.
If you just want to wrap your site into a native app, you can just put it inside a WebView, which runs exactly like the native Android browser.
If you want to use your html, css and js files to create an android app then the easiest way to attempt this is http://phonegap.com/
However, I would strongly urge you to build a native app (on Android) as Phonegap comes with tons of problems and less support.

Ttitanium webview and HTML5 application cache

I am using Titanium to create a application for Android. The app uses webview to load external HTML5 webpages. The webpage uses a manifest to cache the page and some assets. This works fine on desktop browsers and third party app browsers in Android (Chrome).
When I view the page in a webview in the Titanium build app, it seems that the manifest is not used, the page just loads everything from the server. The same problem occurs when I use the build in browser of my phone (HTC one X).
What I am trying to accomplish is that the pages are offline available, so that internet is not required tot view cached pages. Is there a fix for this problem, or should I go look in another direction to solve my problem?
the manifest file:
CACHE MANIFEST
# version 1
leerlingen.html
jquery.js
style.css
handler.js
NETWORK:
*
First: Titanium provides much more than a WebView. If you planned to display only web pages you maybe should have a look at PhoneGap / Cordova which might fit your needs in a better way.
As you've noticed not all browsers support HTML5 Caching feature as expected. I can't say if it doesn't work for Android in general or only for your specific version because WebKit usually does support it but it depends of the used WebKit version. And this could be different.
EDIT: It seems that (in native android) this feature can be enabled as written here: Application cache in HTML5 doesn't work in Android PhoneGap application. This is currently not possible in Titanium (there might be inofficial tweaks i don't know but from http://docs.appcelerator.com this is not possible).
Personally i'd prefer another solution. Cache data by myself and display it if there is no network connection. But this depends on what you try to achieve. Having few content which doesn't change often this would make sense. Having dynamically changing data (like twitter stream for instance) this would be difficult. Also it depends on your users and where they want to access your app.
And there is an open question: When you want to use all the caching features why do you want to create an app? Creating a simple mobile webpage would do the same job. When creating an app i wouldn't use the Caching Features of HTML 5. You should keep all the static resources in your app and simply load data from the network. This can be achieved by both Titanium and PhoneGap / Cordova. Titanium is more useful for a native UI and some native Features while PhoneGap / Cordova would be more appropriate for HTML5 based layout.
Just in case someone else is running in the same problems that i was facing, here is what i've done. HTML5's application cache does not seem to work in the build-in browser of Android and with that the webviews. In Titanium there seems to be no way to control the webview as to enable the application cache.
The work around for me was to use Titanium and it's httpClient function (Titanium.Network.HTTPClient) to request the files (HTML, CSS, javascript) and store it in the local app filesystem (Titanium.Filesystem).

Android native code from web browser using javascript

Is it possible to access android native code using javascript in the default android browser?
Regards,
Dom
No, sorry.
You can create your own Android app that exposes Java objects to WebKit through the WebView widget. Also, you can link to Android apps from your Web content displayed "in the default Android browser" (whatever that might be for the user). And, you can arrange to have an app that you write respond to URLs that otherwise might go to a browser. But that's about it.

Categories

Resources