How to load dynamic content in PhoneGap? - android

I am looking to use PhoneGap as my framework for an app that I will be developing for iOS and Android.
The client has a CMS that has already been fitted with a web service allowing us to generate a clean HTML page with the content. (Text and images)
Our goal is to allow the client to update his application with his CMS. What we thought could work best was to load the HTML generated by our CMS web service and inject it into the specified PhoneGap page. This would allow the client to have a dynamic application that he can manage certain pages through his CMS.
I have read that using a web view will NOT be accepted by Apple, so consider that we obviously want the app to be approved in your replies.
How would we go into getting a web service to load the dynamic content into the PhoneGap App and be approved by Apple?
Many thanks!

Loading an entire HTML page is not a wise move. It would be better to let the webservice output JSON wich you can then read with your app. Phonegap is html based so you can build a DOM from the json.
If you want to generate a full HTML page on the server then you can add the result of the service to your DOM.

Related

How android application and web application working?

I'm a little confused because I couldn't understand how android application working at the same time with web application . for example I have a web site and I wanna have a android app for my website and how can i programming at the same time , can i build my android app with php ?? this is the main question i have and i don't understand what i should do and how web site and android app working . for example Amazon has a android and ios app at the same and Amazon has a website , how those thing working together ???
You can build a webview app that is app where you can display HTML with Css and maybe also JS.
That is what google said about webview app:
By default, a WebView provides no browser-like widgets, does not enable JavaScript and web page errors are ignored. If your goal is only to display some HTML as a part of your UI, this is probably fine; the user won't need to interact with the web page beyond reading it, and the web page won't need to interact with the user. If you actually want a full-blown web browser, then you probably want to invoke the Browser application with a URL Intent rather than show it with a WebView.
You can find more information about a webview app is here: https://developer.android.com/reference/android/webkit/WebView.html
If you have any other questions about it feel free to ask.

Migrate my E-commercial website on mobile phone platform using PhoneGap

I have just created a website based on prestahsop template (PHP + SMARTY), and I have made it work online.
Now I want to migrate the project on mobiles. I searched for several means of doing that, finally I am about to use PhoneGap for my solution.
But I have no idea if that can encapsulate the whole project on the mobile platform, and ideally be launched on Apple store. If not, I would like to get some advice to make changes.
Anyone having former experience can come to help? Thanks so much!
In addition to andre3wap response, you can use Prestashop Webservice API to link your application to your website. I've already done this in the past, the tricky part comes when you need to create an order in your Prestashop website from your application. But it's completely doable.
You will have to create an HTML + Javascript application with PhoneGap, that calls Prestashop via Ajax requests. If you want your application to work offline (and only create the order when the customer is back online) you will have to load every products on installation and sync when the app is online.
It's a lot of work.
EDIT related question: How to integrate prestashop with android?
If your web site only consists of HTML pages, yes; PhoneGap will be able to do most of the work(Just upload your HTML pages in a folder to build.phonegap.com for the conversion), there are other methods that can do the conversion, but that one is easier to me. (Read their documentation)
If your web site was created from a server side language, NO, phoneGap will not be able to fully convert it into a full fledged HyBrid App.
It gets very tricky when it comes on to Server Side scripting + phoneGap. What you can do is build html pages, and create "APIs" to load the data in the APP and use JavaScript to parse the data respectfully. (That phoneGap can handle)
You can read this article for an even more detailed explanation:
Usefull Article

How to show web content in android application without using webView

i am still developing android static app in which all the content are static , all the content which is deign by me nothing is taken by website but now
#
i am starting to develop web app that is, all content coming from website .
i searched lot of thing i got only "WebView" in which whole website will show in my WebView .
So there is a Problem, i want to get a specific content from any website like Event images from website and show in my Activity.
Please help me to start web app development.
is there any api ??
Thanks in advance.
#
In my understanding, what you want to create is an Application that will show content from a website, but not using WebView.
For those webs that do not provide an API (your own website, for example), you may want to have a look at JSOUP and give it a try.
For those webs that have API (for example: twitter), you should read its document and try some HTTP request.
You'll need to write APIs which'll allows you to make requests from your android code to the server code. Using these requests you'll be able to fetch data stored on a web server in a friendly format that can be used to display content on your android app.
I see you have clear some concepts, like Web app, browser, events. But remember the Logic from webApp is with javascript, so the Webview download the HTML to the device and if you have activate javascript in the webview thats work fine, remember you have some restriction with the hardware and process with webapps.
But android developer has a tutorial to create web apps.
When you create a native app doesnt mean is static, you can use Json, XML, Rest API, Web services, etc. to comunicate with a web server.
I recommend see how connect android app with external resources and webserver, here is an example.

Convert Ruby on Rails app to native Android PhoneGap app

I've been working on a jQuery mobile web app written in Ruby on Rails, and would like to make it available as a native Android app. I've setup the phonegap project to load my url, and everything seems to be working, but I've been reading that Google will reject the app if it's simply a webview container to an external url. Has anyone had any experience with this?
From what I can tell, I'll need to rewrite the web app to use ajax calls to populate the page, as opposed to relying solely on web requests to my web server. Can anyone offer any insight into this? Would they accept a PhoneGap app that simply loads an external url? Any help is appreciated.
Update1: I've also read that being able to handle no internet connection is one of the main reasons they will approve/reject your app. I think this could be handled in the android app with some logic that checks for an internet connection, and if it exists, load the external url, if it doesn't load a local html splash page. Would this idea be ok?
Update2: Would it be an option to have a "skeleton" of the app as basic html files within the phone gap app, which just uses ajax to pull down all of the main html? That way the app would still function without an internet connection, but you could also make large changes to the content of the pages which would be pulled down in every request. Is that a viable option?
I've never heard of an app being rejected from the Play Store due to just being a WebView container. But even if they wont reject your app for this, you shouldn't be building a PhoneGap application this way. You'll end up with an app that will feel like it's just a WebView container, and an app that breaks easily when connectivity gets spotty. Remember that even in good reception, latency on a phone is high, so reducing the number of requests you have to make (for static files and assets) is paramount.
Ideally, when porting a web site to a PhoneGap application, you should be decoupling your interface as much as possible. Fewer variables should be passed down from the controller to the views, and more data should pass through AJAX calls. When your front end code (all of the files in app/views) can be served statically, moving to a PhoneGap app is easy.
Ensure that the actions in your controllers all have responses for JS (format.js), not just HTML. Your views should be making AJAX calls to rails to get the data that fills in pages via AJAX. Then you can bundle your views (and your assets) into your PhoneGap app.

Interact with websites?

If i am developing a third party tool. is there a way to interact with that website?
For example i am making a android Application which allow the user to search a specific website. Is there possible to load the search result in listview?
This was just an example.
So get information from a website becuase i want a different layout and so on.
EDIT* and how do i do it?
Thank you!
1) If you want to display the content of your webpage in a specifically designed application you can use WebKit, the web engine inside android, in a WebView. Check more on this link.
2) If you want to have a more granular control over the data shared you can use the apache http client to share data over http, and reformat it for the user. You can also set up customs http request between the terminal and your server to improve the mobile experience.

Categories

Resources