I would like to make an additional app to my website - is based on PHP & MySQL. Website should be shown in the app. So I would like to ask if PHP & MySQL are allowed in developing android apps? Just to shorten the time spent on programming the app and reduce or skip JS or other languages.
Thanks a lot for answer.
No, that is not possible. You can not build and android app based on php and MySQl. PHP is a server side scripting langauge, while MySQL is a database management System. What you can is that you can provide APIs which may be used by your mobile application to get and post data.
"Allowed"?
Well Android runs third party applications using Java. You can run more languages using the Android NDK, but the PHP+MySQL is not supposed to work on Android as it does on lets say Apache...
It's Android: a Java-based OS.
And I doubt you'll save time like that.
Make your website mobile-ready or build a regular Android (so Java) application is my adice.
Related
I've got a book I bought online - O'Reilly's Building Android Apps with HTML, CSS and JavaScript. The idea is that you can use these 3 to create a website that can be converted to an Android app by using a Java conversion tool.
Hopefully someone will be familiar with this, and hopefully this is possible - if I have a website that is already created that also includes PHP, could this be used for the app?
I've created PHP sites before, and the one I'm specifically looking at is referencing a MySQL database, hence my need to use PHP for the app. The website is heavily based on PHP.
No you can't (Unless you created your own framework which runs a local php server inside of the device which can be accessed by a webview). Php is a server side language. Html and JavaScript are client side. These html app creation frameworks use the webview to run apps. Be careful as there are performance issues when running through webview as it is not a native app (projects like crosswalk help but still many issues). Popular frameworks include ionic (Angularjs), titanium (is mostly native but from my experience limiting), and appgyver (Angularjs).
Yes you can! If by "converting" the website to app you mean displaying the website in a chromeless view mode (without address bar).
If you wan't to use phonegap / cordova you can still use the existing PHP code as backend for the database (Maybe rewrite it into a Restful API).
If you want your app to run natively and without internet connection, then you are out of luck though.
So I've built a web app in PHP that relies heavily on a MySQL database. Now (for user convenience purposes) I'm trying to create the exact same app, just as an iPhone app. Granted, I have no knowledge of Objective-C (just starting to learn it), I wanted to know how to go about this. I know that I'll have to use some kind of intermediary to get Objective-C to connect to the SQL database.
So essentially my questions are: If I've already created the web app as aforementioned, could I use the same DB and tables for the iOS app version as I did for the PHP web version? Also, is there anyway to migrate any code I've created in PHP to iOS (I realize that they are two completely different languages), but I'm just curious as to whether or not I'll have to build the iOS app from 'complete' scratch.
Your best bet is to write an PHP service to talk to your database.
This way you can share this API between your app or iOS app or any other type of client app.
The service will be responsible to receive request query the database and send responses in JSON format for example.
So to make things easier, you should not query the database directly from your apps, use a common web service.
You can use your MySQL database for any purpose because it is just data. The code that will show them will be different though. If you have no knowledge about Objective-C you should consider the web-app approach.
Here are a few helper links.
https://developer.apple.com/library/safari/referencelibrary/gettingstarted/gs_iphonewebapp/_index.html
http://gigaom.com/2010/02/12/how-to-create-an-iphone-web-app/
If got a task to create a mobile application for iOS, Android and WP. This application needs to access a mySQL database which is already in use by the website running php.
What I found in the meantime, is that I have to create a php webservice and use this webservice to access the data in the mySQL database.
Since I did not found any clear advice which way is the best to do it (JSON, XML, REST, etc) - I just wanted to ask you, is there a kind of best practice which technologies should be used for the php webservice?
Additional it would be great for me if someone knows a good tutorial for the recommended technology.
Thanks a lot.
I am arriving a bit late but here is my answer : I believe that the easier way currently available is a PhoneGap application (with Sencha Touch or jQuery Mobile as a javascript framework) talking to the server through a simple PHP webservice. PhoneGap allows you to build an Android, iOS and WP app with the same codebase.
We use that technology in my company and it works great.
I'm developing an Android app, and due to time circumstances, I started developing the project in PHP, together with a MySQL backend. is it possible to package the project folder as a APK where it could be opened within the tablet?
I understand Android applications are meant to be written in Java, and I have checked out:
http://phpforandroid.net/
But it doesn't answer if it was possible to package a complete PHP project as an APK.
No. Since PHP is a server side language you would have to run a webserver and a MySQL server on the device (like #deceze said).
Since you have already started development in PHP my recommendation would be to develop a web based application and have your users access it from a very lightweight client on the Android device. You could use something like PhoneGap or AppCelerator to develop a front end client app since I'm guessing your talents lie in web development :)
"When all you have is a hammer, you start to approach every problem as if it was a nail"
You're using the wrong tool for the job. PHP is not meant for writing interactive GUI applications, it's meant for running server side scripts or commandline scripts. Even if you could easily run PHP on an android phone (which you cant), it would be the wrong choice of language for a phone app.
You have two options
1) throw away the work you've done so far and redo it in a language more appropriate to the task at hand
2) deploy your application to a publicly accessible web server and run it via the handset's web browser.
If you think about it, you'd need to squeeze a web server, the PHP core, whatever extensions your application uses and a MySQL server onto a handheld device. This is seriously overkill.
And why MySQL? Android provides SQLite database support.
I am a php developer with a few web apps like a project management app and a forum i'd like to move to Android and iPhone.
I've heard of developers using Sencha Touch and PhoneGap to develop native apps and I know they support HTML5, CSS and Javascript, but how abot PHP? And is are there any other APIs/frameworks I should consider that better support local server scripting?
Speaking about webapp, maybe you can avoid building an app by having a mobile enabled version of your website compliant with all the client browsers.
Have a look at jquerymobile, it is compliant with mostly all the mobile browsers and you will be able to reuse your code.
To answer correctly, you can call your webservices using ajax to fetch json/xml/etc data from Phonegap because it is using jQuerymobile ;-)
Have a look at this discussion here on Stackoverflow :
Passing formdata from Phonegap to PHP with JSON
Hope this helps
PHP is a server-side scripting language and your .php files have to be stored on the server side. You can access them asynchronously with Ajax, so no, you can not include php files (with reasonable time and effort) in your app.
The only smart way to go here is native iOS apps, forget PHP, Android and the rest of that crap. By the way I'm not trying to be an iOS snob here but am just reflecting on a few realities. One is that iOS apps can actually make money though a web replacement app might not. The second issue is that going native demands a reboot on your part, that is best done on one platform until you get up to speed. The third issue is that users now a days expect well performing apps that don't have a lot of web cruft in them. Fourth the Android marketplace is screwed, you are far more likely to establish that critical user base on iOS as you can target a handful of platforms running the latest generation of iOS, android is by comparison a pathetic mess of old versions of android running on all sorts of hardware.
On iOS look a BlueAlien as an example of a better than web method of accessing Reddit.