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
Related
I'm trying to build an application, "Journal for Drivers".
I would like to add new information to the driver in this application. This information will be in text format (or text with images)
My question is, if I want to add a news update to the application, a news for drivers, can it be solved for example by some storage on a server, where the application automatically downloads this news? Or do I have to write the entire app in Android Studio and update the original version of the app?
There are three main ways to accomplish this:
You can create a webpage and use webview component to load this website in your application. In this case you will have full control on the data (backend) while you can change the ui of this webview on the fly without releasing new versions of your application. called also hybrid application (which is part native you still need to create apk with this webview) and web part which will be where most of your code exists.
You can create a native application which will be written in native only (java or kotlin) in this way you will need to release a new version every time you will change anything in your application. (including logic change or ui change).
You can create PWA project which will simulate a "native" application in this way you control 100% of the code and it will based on web. You can open a url on your mobile browser and you could "install" a mobile version of the webpage on your mobile device which will simulate a "native" application it also other platforms such as iOS, windows and Mac (if I'm not mistaken)
This can achieved via an endless number of strategies. One such strategy uses deep links along with an API for this. For this to work, you will need to set up an online server which will serve as a back end. This is where you will post your news updates to an endpoint or endpoints. This can be implemented in many ways. For example, you may just hardcode your updates to the html, or more likely you will store each article to some sort of db. When a user of the app goes to view an article, it will send an HTTP request to the server asking for the article. The server will then retrieve said article from the db, process it in whatever way needed, and send it back to your app.
Using this method, you only need to change your article on the back end (or better yet add your article to db and update a pointer that points to current article).
I'm trying to do some simple website application for displaying my website and add some specific functionality to it.
My idea is to do something like Facebook app for mobile. Simply I need to display a website and replace File input - users should be able to capture a picture from camera or pick it from gallery (multiple select) and attach it to a post.
TL;DR;
Check images in the bottom.
What I have tried:
Using Cordova with Camera and Image picker plugin and displaying webpage in InnAppBrowser
Taking pictures with camera and picking pictures from gallery and then uploading them to server - there is a lot of examples of it.
What troubles I have found:
InnAppBrowser is forced fullscreen so I cannot resize it and place some buttons for picking pictures under it.
What do I need:
I just need to somehow attach images (from gallery or camera) to form file input or upload them to some kind of api instead - the api would process images on server and return some IDs which I can use instead of file input in the form on page to attach images to the post. Some hidden input where I would just insert IDs of uploaded images to be attached to the post (I'd write some if conditions into my PHP script).
I need my application to be multi-platform (Android, IOS, WP) so that is the reason I'm using Apache Cordova. I've tried lot of solutions and I've searched like for 5 hours. But I wasn't able to find anything useful.
Have somebody some experience in this way? Did somebody make some kind of that application?
If you can suggest any solution (it is not important to be a Cordova but it must be multiplatform) I'd be glad!
Thanks for your time!
Images
There is screen of desktop version with normal file input:
There is my vision of mobile application version with camera and image picker option right under web browser:
I guess I was not clear. The technical answer is Cordova/Phonegap are not for creating website applications. This means technically there is no "correct way" to do what you are asking.
For a website applications, all the pages are rendered from the website and controlled from the webpage/webbrowser.
For a mobile application, all the pages that the application can directly control are rendered on the mobile device. However, pages can be rendered (and/or created) from either the server or the mobile application, but the control of the page stays with the side that rendered (or created) the page. There is clear line between the two sides that can be moved, but at the *peril* of the programmer. (There are no points for being clever here, only added security issues.)
However, the Cordova and Phonegap do have plugins.The entire purpose is to use plugins to make certain task easier. However, there is a clear line between the phone and the website. To be clear on this last part, this means that all of the "plugin services" on the phone (accelerometer, contact list, etc.) are directly available to the application, and not the website. However, some of the "services" are also available as HTML5 APIs, such 'camera' and 'geolocation' – mixing the two is dangerous. The HTML5 APIs should remain on the webserver side, if used. The UX is different for HTML5. (I will not discuss HTML5 APIs any further, as they are beyond the scope of this discussion)
To make your idea work, you will need the following "core" (or equivalent third-party) plugins
file-transfer
camera (or equivalent)
inappbrowser
On the file-transfer and camera, you can do everything from the webserver, if you want. Then the only task for the end-user is to select the appropriate folder and image. If you do this from the server-side, then you CANNOT use the plugins.
If you want to use the plugins, then you cannot use a server-side generated webpage. You must create the form on the mobile device. This means the page and the form reside on the mobile device. However, if you write your webpage correctly you can dynamically add or delete elements. This means on the mobile side you have control over every step of the user experience and can enhance that experience.
On the inappbrowser, a common trick is to put the website in an iframe. However, you have no direct control on the iframe. Another common trick is to submit to the server via an API – then have the visible webpage update separately. Another common trick is to have a webpage with a websocket that could handle the webpage update. However, this could also be done with a push to the webpage, or have the webpage do polling of the server. Again, the App has NO direct control of the webpage.
This entire thread makes the following assumptions.
There is no "correct way" to do this task.
The images (photos) are stored on a website, and are publicly available for viewing.
It also assumes that no HTML5 APIs will be used.
If I interpreted your problem statement correctly, I believe what you are looking for is access to device native services - camera & gallery - from your mobile website.
A solution that fits your design requirements is for the browser to provide such services. Unfortunately WebKit and other browsers limit such support to things like Geoposition.
The way for Cordova to help you here is if your mobile website is an stand alone HTML5/CSS/JS application that can use CORS XHR or WebSockets to communicate with webindependent Web Services.
If you can bottle your website into a set of static html/js/css files that display content from dynamic web services then you are set. That same javascript can then call navigator.camera.getPicture(success, fail, options) and file-transfer the result to a waiting web service.
That camera api is not available to the InAppBrowser just as it is not available to WebKit Chrome/Safari/Edge. Trying to control the Mobile App via the InAppBrowser is most likely to fail due to security constraints.
What you might get away with is re-imaging your browser application as a series of discrete services that return raw html snippets suited for a new mobile app. Then write your Cordova app as the top level container that manages the navigation amongst the html snippets. This server-side rendering would be most useful if it was significantly challenging enough to overwhelm the mobile platform / web services pattern (think custom video server or expert system).
#Jakub,
Cedric has essentially stated it plainly. I will restate. You understanding about Cordova/Phonegap is not correct.
From: Top Mistakes by Developers new to Cordova/Phonegap
You have hit issue #5.
I QUOTE:
From Phonegap FAQ
A PhoneGap application may only use HTML, CSS, and JavaScript. However, you can make use of network protocols (XmlHTTPRequest, Web Sockets, etc) to easily communicate with backend services written in any language. This allows your PhoneGap app to remotely access existing business processes while the device is connected to the Internet.
In addition, Apple frowns on using apps as wrappers for websites.
Quote Apple iTunes Guidelines - 2.12
Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected
To be clear, your idea may be valid, but you will likely need to rethink your internal workflow. You likely want to keep the same UI and UX.
Hi i new to android development i want to develop an android app for website which does not have JSON or XML API for providing data is it possible to get the data from the website as it updates to my android app please
Help even the slightest hint will be appreciated.i have Googled this but i didn't got proper answer
Yes, it is possible. You will need the following components:
The website won't notify you when something changes. Thus, you have to poll the website frequently to find out if something changed.
Since the website offers no API, you will have to download the HTML and parse it.
Using these keywords in your search, you should find lots of material on StackOverflow, e.g.
Android Polling from a Server periodically
How can I parse webpage content in Android
If you want to make an app for a website, then you will have to get that website and parse it and display the results however you want. A good example for this can be found under the Spring for Android's Github page
If the website you intend to parse is already available in the Spring social package, then the above examples will already provide you with the solution (or with something very close to it). But keep in mind that you can also do the same thing without Spring but you will have to parse the data manually.
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.
I have the following scenario below: Please guide me.
I already have an existing web application develop using PHP & MySql, It works perfectly on
on a normal browser. What I would like to do is have the very same functionality, on
my "Android App" "iOS" and "BB".
I have been going through multiple forums, and I am still very confused. Here are my reasons:
I do not just want to load the app in the "WebView".
I want to be able to log in to my web app through phonegap, (need to send the credentials to the web app)
After logging in I want to be able to format the generated .html (to display on mobile)
On my browser it allows me to upload content to the server, if possible I would like to this as well:)
I already have the latest version of PhoneGap + ADT & SDK + Eclipse, I can develop static html apps
without any hassles, now, I just need to have client side html that talks to my server side php.
Something similar to the Facebook app and the Facebook Mobile Version.
Any suggestions.
I have just completed a project using PhoneGap, Backbone JS and Require JS, these acted as my MVC for the front end application which sent ajax request to my back end PHP application, which was converted into a rest API. Laravel does this quite well, but it might have to be a custom build for you if you are already relying on a bespoke PHP build.
I was able to deploy to Android and iOS. However, using PhoneGap means that your application will be loaded in a WebView, this might help exaplain a WebView in more detail.