Ok, so I am very new to android but I have some experience with PHP. I have a website for my college festival where there is a login system and registered users can take the quiz everything.( I am using Codeigniter as my PHP framework
Now I have been asked to make an android app for the festival. So , my question is , How do I connect my android application to the stuff on my website.
For example: I have a login system on my website and I want to reflect the same functionality in my android app i.e How to send the username and password to be authenticated and how the request will be processed on the server side? How do I connect my android application to my database ?
Can anyone please point me in the right direction. Thank you very much.
P.S : Yes, I get that I can very easily just make a mobile version of the website as suggested by many people. But since I want to learn Android, I think this would be a good opportunity for me to do so.
You may write a service using PHP which takes required parameters and responds with JSON Object response. In your app you can use HTTPClient and JSonObject to parse the response and populate the app. Here is a sample on how to do Android PHP MySQL example
If you don't need native mobile APP, then as other members suggested, you may add mobile css to your existing site.
Related
I've developed a website with the usual crud functionalities in Codeigniter and MySQL. I'm now tasked with creating a mobile app (with the same functionalities ) in Ionic 2.
To access my database with Ionic, I created a REST api -- which I was able to manipulate smoothly.
My questions are:
How, or can I, use my MySQL users' credentials to log in on my Ionic 2 app?
How can my web and mobile can share the same database?
I've been reading a lot about Fire base,etc. However, my tiny brain is unable to comprehend whatever I read. If anyone can point me to right direction, I would highly appreciate it. Thanks!
When developing an Ionic App you have to think of it as if you were developing a regular website. The only difference is that you have access to native device features with cordova plugins, but the whole flow is almost exactly like in a regular website (it is an angular application after all).
This means you can use your API just like you use it in your website. There is no need to use firebase. (Firebase is kind of like a database itself that you could use INSTEAD of your MySQL backend)
Totally agree with #Andreas. When you build a modern application that supports on the different platforms such as web or mobile, you need to design a standard API and then next step is to build a web application/mobile app to consume this API. And because of all the web/devices are all consuming from the same API, they are interacted with the same database. Unless they are using different API.
Can refer to the image below for easy understanding.
So talk about how authentication and authorization can be done from the mobile app or from the web app. You should take a look at OAuth2. It is a protocol for securing API services from untrusted devices, and it provides a nice way to authenticate mobile users via what is called token authentication.
The workflow will look like below, on both web and mobile app.
A user opens up your mobile app and is prompted for their username or email and password.
You send a POST request from your mobile app to your API service with the user’s username or email and password data included (OVER SSL for sure. If you don't know about it, google it).
You validate the user credentials, and create an access token for the user that expires after a certain amount of time.
You store this access token on the mobile device, treating it like an API key which lets you access your API service.
Once the access token expires and no longer works, you re-prompt the user for their username or email and password.
Reference
REST API from PHP
The ultimate guide for Mobile Security
I am new to android development and i am willing to make an Android app for Managing Notes and Task as well as i want to make a Web app for the same using PHP.(For learning purpose like Google Keep).I want both of this web app and android app to work in sync with each other, Just like Google's Google Keep works on Android and Web as well. what would be the easiest way to do this?
Is it necessary to create a REST api for my web app so that my android app can query the web app ?
Also i saw somewhere on internet that i should save all my data in Mysql Database on server and my Android app should retrieve all the data from the server but i if will do this then my app will not be work in offline mode.
Please help, Thankyou .
Yes,You should have a main Database on server and your Android app should retrieve all the data from the server,then Save them in your local database in android that can be same as or lesser than your main database.
Now you can work offline ,and when data has changed in your app ,you should keep them somewhere and sync them with your server database as soon as you got online.
and also you can use push Notification to notify your app that some data has been changed and no longer valid and application should update itself.
It's my idea Hope help you
I have to make an application that receives commands from a website and therefore perform an action.
I thought about creating a login in android to send the username and password for POST and if this is correct, the web server will return a unique token. That would serve me later to send information to the server and ensure authentication...
But ... how can my android application know when the website has a warrant for?
I've thought about that all the time is pending a URL "checkOrders" and if it finds your token, request orders to another URL
Anybody know other method to make it?
If I understood your question correctly, the only (battery and otherwise) efficient way is using push notifications. Unfortunately, this approach is not even close to being simple.
Since you're developing an Android application, you may want to consider Google Cloud Messaging and Parse Push. If you're planing on developing apps for iOS and Windows phones in the future, I'd strongly recommend Parse Push. At the moment, it's free for up to one million users.
Hyperlink for GCM will lead you to generally useful reading on this topic. That's why I am not elaborating here.
I have an existing web app that I have written in CodeIgniter using a MySQL database.
I now want to learn how to develop an iPhone app for the web app.
I have had a look at a lot of tutorials about xcode and iphone development but I have yet to see one about connecting and displaying data from my database.
I have seen the topic of RESTful come up a few times but am unsure if this is the direction I need to go?
If anyone has had success in building an iphone app that connects to a MySQL DB, would they be kind enough to share some tips or tuts on getting started.
I was working in a similar project: http://www.savemeeting.com It consists in an app (iOS, Android and Blackberry) and a Web showing the same information. Basically you need a Web Service (RESTful, XML-RPC, SOAP...) server and a Web Service client in your app.
I recomend you to write a RESTful server, if you use Code Igniter, you can use this library: https://github.com/philsturgeon/codeigniter-restserver and then write the client in your iOS app (sorry, I have no knowledge to guide you in this part).
I am trying to develop an android application that will use the same MySQL database as an existing PHP website.
I have the php codes for every operation done by the web site, for example the php code of making an advanced search.
My problem is that I don't know how to implement this operations on my app.
I assume that I should use webservices, but I don't know which type.
I appreciate yourhelp guys...
PEACE.
Its Easy , You should use Ksoap2 library to implement webservices for android. Check this example creat a login page in android