Android: Creating Formatted Native Android Application that takes Web Content - android

I'm trying to code a native android application that takes certain parts of a webpage and displays it. Basically I would want a search bar and several other things, so that I can have a clean fitted display on a mobile device. It is the same idea as the Facebook application, I am trying to create a stripped down version of a webpage.
I know how to download a full webpage using a WebView, but how can I take only certain parts of that webpage and display that instead?
EDIT: Is there any way to do this using just java and java-based api's?
(I am writing the application in native JAVA)
Best,
Aneem

It sounds to me like you effectively want to do 'web-scraping'.
I've done this by using an HTTPClient to pull a web-page which I then processed with HTMLCleaner to produce an XML document. I could then drill down through it to extract the various elements I needed (tables mostly).
You'll need to reverse-engineer the web page using the 'view source' capabilities of a web browser.
Be aware though that unless you have total control of the web page source, web-scraping is generally not a great way of producing a stable and extensible app. All it takes is for a re-design of the web page by whoever maintains it and it will potentially break your app completely forcing you to rewrite your HTML processing code.
EDIT: Actually, on the subject of the Facebook app - this isn't the same thing. There are published APIs for accessing Facebook which don't involve accessing the normal Facebook pages. The Facebook app is a 'native' Android app not a web app.

Its not sure from your question if your back-end has web api's implemented via REST, SOAP, whatever. If it does then you'd just use the necessary pieces widgets and all to implement your android application.
If it doesn't then there may not be a direct way to implement what you want. So I'd suggest looking into the back end first before looking at this aspect.
However, you might want to look at PhoneGap if you want to implement a cross platform solution.

Related

How can i build native android apps from any website (Not Website convert into apps)

Suppose , i have a website and its running well . Now i want to make an android apps using website information or My apps will contain all the information of that website already contain or how can i connect an android apps with any website.
Some solution :
1. convert website into android apps (i don't need this).
2. JSON API (i think this is best option for me ).
May be there has so many option but this time i can't remember. option is best for me if it is possible . but i don't how to create a JSON API from website .
but i don't know how to do it. please let me know share something for better understand.
or if has any other better solution for this problem please let me know .
You could create a web app, using android native web view or some technologies like ionic, etc..., or create a comprehensive API endpoint in your backend/website and start build an android app from scratch.
creating a web app is a simpler approach but has so many shortcomings in design, functioning and flexibility aspect, so if you want a competitive app with a fine extendibility feature the best option is native android development. but it could be more costly as it needs both backend and android development.
If your website is already implemented and running, you can just create an Application using a https://developer.android.com/reference/android/webkit/WebView. Basically, this is an injected Browser, allowing the user to access your Website without actually open chrome/firefox etc. on the smartphone.
To improve the usability, the layout of your website should be able to dynamically resize the content.
If you wish to actually implement an application (Activities/Fragmets...) you need to connect to your backend server the same way your website is retrieving the information.

Can we make Home replacement App in PhoneGap?

I want to make an home launcher replacement application (e.g Nova Launcer or Go Launcher) using PhoneGap. I've read about PhoneGap plugins but I don't think this feature can be implemented through Plugins.
So is it possible to make a home launcher replacement App?
There's already such a project. You can take a look at this project.
https://github.com/AricwithanA/DOMLauncher
It is a launcher made with phonegap.
The answer to your question is "yes". Phone Gap is just a WebView inside a Java Android project. If something doesn't have a Javascript interface, nor has a Phone Gap plugin yet, you can just make one yourself, or you can just use Java/Android xml directly.
The real problem with using a WebView as a homescreen is that it will really be slow (with no apparent benefit otherwise of loading all the capabilities that normally come with a WebView).
For a project like that to make sense, a cool project you could try doing is to replicate some of the iPhone functionality that's talked about here.
[...]
I expressly endorse this request, as it is not possible to offer a
native-looking WebApp in Android at the time without implementing a
shallow hull of an App, containing just a WebView (or implementing one
of the popular Frameworks like PhoneGap or apparat.io).
This leads to the point where you have to pay 25 USD for offering a
native-looking WebApp on Android. The same thing is free on iOS
devices - and more elegant
In that case, it would actually make sense of using a WebView. Anytime you would have to deal with actual web content, it makes sense to use a WebView because a WebView does a lot of that html rendering/parsing work for you already.
On a side-note, the web site owner I quoted above is slightly wrong about having to pay $25. In Android, he could just have self-signed his own app and distributed it through his web site, although, his main point remains: iOS does do the bookmarking/installing of a web app locally much better than Android, and it would be great if we could get something like that on Android (that could save/install locally the web sites that were especially made for iOS).

Architecture for iOS and Android Project using web view loading html and js from server (singe code base)

We have recently started a Hybrid project(?) to work on iOS as well as Android with the following specifications:
Html pages, Javascript file, Jquery based libraries files and resource files (Images) are hosted on a server.
The hybrid code (iOS or android) loads the html pages in the web view and the page navigation and event handling is completely like any normal html and js based website. We have taken care of CORS for AJAX web service calls. The data is basically stored as local storage(browser's support).
Most of the data that is viewed by the user is live from web service calls, Except some of the images captured using camera which will be stored locally in the application sandbox. (For camera invocation, we have written native code.)
Why the architecture is planned in this way ?
One of the reasons - Any modification in the application will be handled right from the server as I mentioned that all the html and js files are centrally located on the server, Ofcourse also to skip the Apple's App submission process).
Now I am not really sure if there might be any issues with this kind of application - the issues might be because 1. Whether Apple accepts such apps ? 2. Maintenance of the Project 3. Any critics on the architectural design of the App.
I am one small developer in this project, I have these questions for you. Apologize me if I haven't put my doubts in appropriate way. Your critics and answers/tips are most welcome. Thanks..
You should use native code if possible, the performance of HTML5 apps is not very good when compared to the native apps plus the things that you can do with native apps are just worth it. Although Apple shouldn't have any problems with your apps. But As Wesley said they never really follow that consistency of the platform so they just look out of the place. Even in native apps, you might still be able to control simple aspects of your app like theme etc from a server, you just need to think ahead.

Phonegap combined with native code for screen scraping app

I am going to develop a cross-platform app that will need some screen scraping capabilities. The app itself looks like an obvious candidate for Phonegap since the UI is quite static and simple (no fast UI interaction needed) - it is basically a kind of foreign currency comparator which needs to show some updated exchange rates and a few simple graphs.
The problem is however that it needs to connect to certain sites and grab the data from there using screen scraping. There is no API. I have many years experience with screen scraping in PHP, and some experience in native Android using jsoup. And the "app" already runs in PHP (on server) for use in browsers, but the client needs a real app.
What are my choices for screen scraping in Phonegap? I reckon that the javascript support available is not suited for screen scraping, but is it possible without too much fuss to build a native layer beneath the Phonegap app?
I have virtually no experience with Phonegap, so I might have missed some obvious solutions. If so, please advice me.
As a side question, does an equivalent of jsoup exist for IOS (objective C)?
Bobik is the very API you are looking for. It lets you tap into its cloud computing power through the API in which you only provide the urls and xpath/jquery queries. Read my article at http://zscraper.wordpress.com/2012/06/02/client-side-web-scraping/ to see Bobik in action.

How to create a full-featured Android app for a website?

This is my website: http://www.stustu.co.uk..
I want to create an app that can pull down the listings from this website and display the entries in the form I want; enable users to manage their online accounts conveniently within the app; post new entries. Basically, a similar app to Amazon and eBay.
But I've no clue about how to query the information from the website in the app...
The website itself is WordPress based (quite simple, therefore), and my initial thought was to find some API from WordPress. I did find the official WordPress app, which comes with the source code, but it helps little as its code mainly deals with blogging.
So here's my question:
What are the normal ways a web developer would use on the server side to achieve my aim?
Is that achievable for WordPress?
If not, are there workarounds?
I'm a new self-taught developer, sorry that the question is a bit broad.
The most common approach when you're trying to communicate between an app and a website is to use a web service. Popular architectures include using REST or SOAP to communicate with your server.
This video will teach you how to use REST interface properly on your Android application, while in this link you will find that using SOAP has its disadvantages over REST especially on Android(or mobile in general).
I personally recommend using REST APIs with responses in JSON format for your web service. Twitter did the right thing with their own rest api, and you can structure yours similarly.
Other links you will be finding useful as you develop your application:
google-gson
jackson JSON
http://blogs.developerforce.com/developer-relations/2011/02/rest-api-android-awesome.html
Sorry about not answering your question about Wordpress, as I never had the opportunity to use it. For my apology, have this potato.
How much experience do you have with android? If you have none you should go find the getting started tutorials on the developer site and complete a few of them to familiarize your self with the structure of an android application before you attempt something like this.
The next thing to consider is: does your site look and act nicely on mobile? If so do you want your application to simply be a dedicated browser that pulls up your site? Or do you want to create the entire application natively? In the latter case you'll have to build (or find) some sort of APIs that allow you to tie in to the functionality of your site from within the java in the application.
My experience is mostly on Android so I cannot suggest any strategies or examples for how you'd go about setting up your APIs. But I do know if you attempt to build something that sophisticated natively on android with little experience you'll likely get frustrated early.

Categories

Resources