Im new with Android. My task is to create a mobile application based on a responsive WordPress website. I would like to be able to download some of the content of this site. Website uses HTTPS. In the first, most primitive version, I tried to use WebView. I wanted to use the following: WebView load website when online, load local file when offline. Unfortunately, only the white page appeared and nothing more. In the case of "Google.com link" a page has been loaded in an external browser (Oreo Android).
Any suggestion how should I start? The easiest way would be to download an HTML page or have access to files on the server. Unfortunately, I do not have that access.
As always -1 without even trying to help....
As I said load from cache when Internet is disabled not working. Work only WebView (without login, because CORS). So how should I face it?
Related
I have to develop a user registration form that is going to run on an Android tablet locally, without internet connection.
The idea I have is to make the submit using Javascript and store the user data in a .CSV file.
The page that show the form will be opened with Chrome or Safari, that is, in a web browser.
Is it possible to do this on an Android tablet? What would be the procedure?
I think that programming the form and then putting it in some internal folder will be enough and then open the index.html file with the browser.
Any advice or suggestion?
Thank you very much.
I am showing a website within a WebView in an Android app. Since this is a particular page which my app has to access frequently, I would like to offer a cached version of it for when the user has no connectivity. So if the user has an internet connection, the website would be accessed from the internet and a copy would be made. IF you access again but have no connectivity, the cached version should be shown.
My app is for API version 9 and above.
My question is, how would you go and download all assets from a particular page?
The webview is already doing that for you once the user visits that view. The page is loaded and cached. You can set the webview to cache on the sd card like this:
webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
link to docs
If this default behaviour isn't enough for you you can look into fetching the content with a httpclient and storing that information. But then you'll have to adapt your webview to go look there first and you'll have to make sure you download all the resources that webpage needs.
So these are two questions you are asking. The one bit regarding WebView and cache was already answered.
Regarding this bit "My question is, how would you go and download all assets from a particular page?", check these links :
How to create web crawler in java?
Simple web crawler on android
How to save file from website to sdcard
First link is a crawler implementation in Java, the second link is basically that code being used (somewhat badly) on Android, the third link should give you enough info as how to download files.
Hope this helps
i'm beginner developer of phonegap android application developer. i'm in confusion. i want to make a photo gallery that work online(with internet). 1st: how can i embed my photo gallery with the application. 2nd: if user connection lost during checking photos there is not show the my app url (could not find URL http://www.domain.com/app/index.php) after connection lost it will go to on default error page of no internet connection.
my online application is in php how can i iframe that app in my native application.
phonegap android application developer help me. i'm very thankful to you for this.
Phonegap is not really a way to embed a full application inside an app. The app itself is its own website (sort of).
Your best direction is to create a PHP page on your sever that outputs an XML or JSON file of the images you are going to show THEN create a custom application using HTML / Javascript that pulls in the XML/JSON and parses it into your app. For best practise you should cache or store said files locally for when the device isn't connected to the network.
I have a website caching pdfs offline with a .manifest-file.
On the desktop version of Chrome the PDF can be viewed offline inside Chrome. But on the Android Chrome nothing happens when I'm trying to open the cached PDF. No error message, just nothing.
I'm guessing the android default pdf-reader can't find the cached pdf?
Anyone who knows how I can view the PDF in Android Chrome?
Thanks!
That's correct, browsers differ in terms of their built-in PDF support. One method you could explore is using Mozilla's pdf.js, which is a pdf reader built entirely in javascript that works just about everywhere. Make another web page that calls pdf.js and loads the PDF, and make sure all of that is in your cache manifest and you should be good to go.
I am working on an application where I load few websites in webview now I want to save webpages so after sometime even if there is not internet user will able to see those pages. But I am confused on how to save whole webpage in cache or any other medium. The main thing is we need to show pages back even if there is not internet.
Has anyone implemented this before. Please provide some demo code as this is my first attempt on cache..
Thank You
The easiest way is save webpages in cache directory or any other(Internal or external storage)
You can get the data of web page using HttpClient.execute() or HttpClient.get() now store that data in .html file also you have to download images or other contents which are bind to that page, Now in your application you have to check for connection if connection not available then load the page which one you saved in storage with file://<location of your webpage..>
EDIT:
I think using HTML5 you can display off-line webpages. (I never tried this, but I referred some blogs on it). Look at this nice post about HTML5 Creating mobile Web applications with HTML 5, Part 3: Make mobile Web applications work offline with HTML 5 Also this
hope this will help you.