Embedding a web based game into an Android Application - php

I've created a simple web based game (text driven) in PHP and have recently become very interested in moving this onto Android - originally i thought the game could be rewritten in Java but after some investigation i found you can embed pages straight into an Android application.
Am i missing something or will i be able to simply embed my web application into Android and expect it to work flawlessly? Is there any issues i should be aware of? My app uses a login system utilising sessions / cookies - will this pose a problem for Android users?
I'd be interested in hearing anyones thoughts that have done something similar and any issues they've encountered. The only issue i forsee is how the page renders on different phones (although this i imagine this can be somewhat nullified by good markup and well thought out javascript) and any issues in regards to sessions / cookies?
If anyone has any good resources for doing this sort of work i'd be grateful.
As a final thought it'd be good to hear peoples thoughts on whether i should rewrite it or keep it embedded, what are the benefits of rewriting it?
Thanks

The WebView class provides access to a full fledged webkit browser. As a matter of fact, the default Android Browser itself is implemented using that very same WebView implementation. Javascript, Sessions and Cookies should be no problem whatsoever, you probably just have to activate them (see WebSettings).
Even flash should more or less work on newer devices, but I don't have any experience with that.
See http://developer.android.com/reference/android/webkit/WebView.html for further details.
Generally, using Apps as so called "launchers", i.e. apps that basically only contain a browser window are somewhat frowned upon, since the android market isn't meant to replicate the world wide web. I do somewhat understand the need for that though, since visibility is much higher and Google does not yet provide a way to treat web apps as first class citizens, like they do for Chrome OS.
On the other hand, if your app already works fine using php, I don't see any need to rewrite it in native code.

Take a look at http://phpforandroid.net/

Related

How to handle authentication in hybrid ASP.NET and PHP website?

I am taking over a community website that was built using Kentico (an ASP.NET-based CMS).
I have PHP/CodeIgniter code that could add interesting functionality to this Kentico website. For example, my PHP code allows for uploading and posting of user-generated material such as images, which the community can then comment on.
Since I'm unfamiliar with how Kentico works, I wonder if anyone knows if this functionality exists in it (as a module). If not, either this
would have to be coded in ASP.NET or
I could have a hybrid website using my PHP code, however authentication from the Kentico side would have to be passed the PHP side of the website.
Any suggestions on how to handle this situation?
You can store the authenticated session in the DB where both ASP and PHP have access
Look into the "User contributions module" - if you've got access to a new enough version of Kentico and the appropriate license then it will probably do exactly what you need it to.
Otherwise if you needed to do authentication from a seperate PHP app, I suppose you could write a simple web service in .Net and add it into the Kentico site. In the past I've used a .ashx generic handler to do this.
Maybe you could include a hidden iframe to the other site on each page and use postMessage in JavaScript to send a session ID between the sites.
I would probably try to keep everything all in one code base unless there was reason to break it out into a seperate module though - otherwise it just seems like a lot of extra work.

How to handle type of users in HTML5

I'm developing an app that access to a service and according to the user privileges make some stuff.
I've been searching a way to handle user permissions and I found that Kinvey provides something close to what I want, but I'm not so sure it will be enough.
I need a way how to handle the different user privileges using just HTML5 without compromising the user security. I'm not that experienced but think that just doing it with JS could bring me security problems in the future (you know, the source code can be seen in the browsers). So, I was considering to use PHP but the app will be moved later to iOS and Android with PhoneGap and I don't know If PHP will work fine in this environment.
I'm driving crazy, can you help me?
Thanks in advance.
html (any version) is a stateless protocol (http://en.wikipedia.org/wiki/Stateless_protocol), a simple communication layer that cannot provide anything like that.
What you are asking is simply impossible, it's like asking a paper envelope to remember your name.

how to convert php existing web application to mobile application

i have developed a webpage with joomla 1.5, now i need to convert my web application to mobile application. the user can download my application through mobile apple or etc then they can access. Tell any tips and kindly guide me...
You could take a look at phonegap ( http://phonegap.com/ )
It is a java framework that you can control with javascript to ring, vibrate, determine position, etc.
There are tutorials for how to make an application for every phone operating system, and they are pretty understandable for beginners. However, since you use joomla, your code has to run on a php server. (The tutorial covers only how to embed local html files in your app).
There are some tutorials out there that cover the use of phonegap with 'existing' websites. Google for it.
In the future, you might want to have a look at jquery mobile, there is an interface builder on their site http://jquerymobile.com/ and it is designed to look good on every device. You can use their themeroller and some additional css to achieve quite a nice app.
Suresh, because it will be important that your users interact with your server where your Joomla installation is hosted, it will be most feasible for you to create separate CSS stylings for your website that will be mobile specific.
Because Joomla has a user community, it is likely that plugins or templates have been written that can help speed this process up. Here's an extension that accomplishes some of what you're looking for, in-so-far as it will allow users on mobile phones to interact with your website via a browser in a comfortable way.
http://extensions.joomla.org/extensions/mobile/mobile-display/11722
Have you tried Mobile Joomla? It's a great extension that would be an easy first step to getting your site mobile-friendly.
"Mobile Joomla!® is the best way to mobilize your Joomla! site, displaying beautifully on iPhone, iPad, Android, Windows Phone and all other phones."
http://www.mobilejoomla.com/
for converting the existing web application to mobile application,you have to create web services of the web application and return the data in XML or json format.at the end of mobile development like on android plateform you have to parse those data on simulator,and this way you can test the application and use in mobile.
Humm joomla is not a good bet for mobile web apps. Even with adapted css and layouts, If you have a lot of extensions, some might break in mobile view.
I would build a a web app from scratch (using jquery mobile, that as a good cross platform support) and get the data from the original website. It might take a while longer, but the experience for your users will surely be better.
EDIT:
From what I gathered from your comments, it seems you want a landing page where people can download a "game" to their mobile phones, is that right? Please explain exactly what you want to accomplish so we might help you.

Web application to sync data with Android phone application

I already know quite a few tricks with Android java and I have an application that I need to sync with a web application. What it needs to be doing is connect to a server and sync database and download jpg picture uploaded by user. The web application should also be for more users each with his own phone and Android application in it, so it should probably be accesable via login and password.
My problem is that I have zero experience with web applications. All I know is a little HTML. So my question is, how should I start? What language do I use? And what basic structure or principle should my web application have?
Thank you!
I would recommend a PHP - MySQL solution. PHP and MySQL are open source and I know Java can interface with that kind of database. Both languages are well documented and PHP is similar to Java in that it is C-based, so if you know Java fairly well, PHP should be relatively straightforward for you. I would recommend heading over to Lynda.com and searching for PHP Essential Training with Kevin Skoglund. Lynda is a great online video tutorial site and you can access a good amount of the content for free. But if you're serious about developing this web application, I would make the investment (I was, and I did, and I am glad). That's how I learned PHP / MySQL for the most part.
First off, to do any PHP / MySQL development, you'll need to install a server onto your computer, such as WAMP (Windows Apache MySQL PHP - for windows), MAMP (Mac " " - for mac), or LAMP (Linux " " - for Linux), where you will be able to begin developing your application. This is your "test" server, or "development" server. For instance, I use MAMP since I am on a Mac. MAMP is free, as are the other versions, but you can pay for an upgrade. For your purposes, start with the free version. Essentially, *AMP comes with the Apache Server software, MySQL database installation, and PHP installation pre-packaged and ready to go with minimal configuration. From there, you can start writing PHP and MySQL and get your project rolling.
As a matter of fact, that title at Lynda.com, PHP Essential Training, will walk you through ALL of the steps I just stated, AND, uses an exercise project of setting up a basic Content Management System to include password protection, user login and authentication, as well as all of the essential PHP and MySQL that you'll need to go along with it. Seriously, check out Lynda.com.
Good Luck!
This is a very open question and you might get a huge range of different answers, neither of them perfect. However, I will try to put a simple response.
Have a single server and expose from it web services. This web services will handle the CRUD of the data (I will assume you will use a database and that you have experience with databases).
Web services is a big topic. If you want the simplest web services, and you're planning to use PHP, I will suggest using RESTful with JSON, since it will be very simple.
The web application should be within the same domain/server of the web services, at least for the beginning (if it grows, you can change this architecture), since that way you won't require using JSONP and just stick to standard AJAX (I will now assume you don't know what JSONP is, I will suggest reading: http://remysharp.com/2007/10/08/what-is-jsonp/ which is just the first result I got on Google just now ;)) and it will be easier.
You say you have experience with Android. I will assume you know how to consume web services using Java/Android. In case you don't, here's a sample of how to do it: http://www.codeproject.com/Articles/267023/Send-and-receive-json-between-android-and-php
Please note the PHP code there is pretty dirty, but as a "how to", I think it looks great. Only thing to note is: the sample uses HttpClient, while the preferred method is to use HttpURLConnection ( http://android-developers.blogspot.mx/2011/09/androids-http-clients.html)
Having said this, PHP + MySQL is standard. In the web app, you SHOULD USE HTML. Please, don't use Flash or Java Applets (I smiled a bit by even mentioning Java Applets in here). For all the communication purposes between the web service and the HTML client, I recommend using jQuery ( http://jquery.com/ ) with AJAX.
Don't go with a JSONP API unless you want other websites to be able to use your API.
This is only a quick approach created with the little information you have given. The more (and clearer) information you give, a better solution is likely to appear.

PHP for iPad, or other solutions

Here's a tricky one.
I'm developing a web app for iPads that will be installed as kiosks. The app is essentially a quiz. Wont need to store data in a database, but will need to process data from 1 page to another page (from questions page to results page).
Original solution was simple PHP. I have now been informed that wi-fi/3g will be unavailable to the kiosks, so they wont have access to the webserver w/ php that has been working like a charm. App needs to be browser-based.
Looked around for solutions for installing PHP on iPad, like PHPPOD from Cydia, but unsure if that is even an option for iPad...and we wont be jailbreaking them. Can this even be done w/o php?
If you won't be jailbreaking them, trying to get a working PHP interpreter on them might not be impossible, but it'll probably be at the very least annoyingly difficult (and it's unlikely Apple would approve random PHP interpreters in their app store).
I'd suggest trying to port the app to Javascript instead. If it's just a simple questions -> results flow, writing a basic Javascript web app with jQuery to help out if need be shouldn't be too painful.
If you're not jailbreaking them, then you will NOT be able to get any un-approved apps onto them. Apple does NOT want you to bypass the app store, because they want their 30% cut. Installing a PHP interpreter on an iphone/ipad would allow you to build apps outside of Apple's control - this is THE main reason why Flash will never been on an iphone - it's not just for playing movies, it's actually a pretty full runtime environment.
You could try using HTML5 local storage, or use the native SQLlite database in iOS.
Without wifi/3G you would need local storage won't you? For this you need not jailbreak your iPad & force it to work through PHP. You could do that following -
Jailbreak the app & maybe try to get your PHP solution working on iPad.
Build a native app with local storage (using sqlite or core data) & handle the display through UIWebView.
Build a HTML5 app with local storage is easy to do nowadays, again UIWebView would be used.
As Amber suggests, you could build all your quizzing logic in javascript, but I am concerned here as to where you'll store data. You need to refer to point 3.
Hope this helps...

Categories