I'm working on project for iOS/ Android application that allow user to Register/Login and than create/share and store files to the server and share it with other users.
To meet this purpose i been following this tutorial: http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app but i found its very basic and i need more information before i start working on it.
My question is, how to create an application for example like Path: https://path.com or instagram, that allow apps to sync with server using API's and pass data between server, phone and users without offering Website to users?
Is there any pre-built open source php/mysql API's that we can use for this purpose?
Any brief tutorial that explain steps to do this (since until now i use to work on basic iOS app and need not require any interaction to server and stuff)?
In project im using php/mysql, in my research i found people also advice to use AFnetworking (http://afnetworking.com/) to replace stranded url fetching, any opinion on that?
I'm hoping to have great discussion on this question since there is lot of questions out there on this topic but non have full descriptive answers!
you can create our own server using tomcat and get the path that act as url for you..and there are many third party framework available for parsing or in iphone they have there own using NSJSONSerialization.you can read the detail from this link.
http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html
Related
Currently building a hybrid app. using Ionic Framework with PHP for backend services
I am having a case where a user has got his profile in Web app and Mobile App as well.
If the user adds two stories as favourites (Its kind of a reading app) from his mobile app or Web app,how do I sync that?
Here are the scenarios:
1) User marks the stories favourites from web app and when I come online through mobile app, display it.
2) User marks the stories favourites from mobile app when he is offline(Now this will be stored in LocalDB). So again when he comes online sync with the server?
I know there are services like Firebase which provides syncing service.
But What If I would want to develop a Custom Syncing service on my own for my application? Is that an extremely complicated process?
If yes and it can be developed ,then how should I proceed ? A basic idea? What are the best practices that I should consider?
Any links would be appreciated?
I know some of the comments recommended CouchDB in combination with PouchDB. That is a much better solution than trying to implement your own synchronization service with MySQL.
However, since you're using Ionic Framework you can also use Couchbase. Take the following example application:
https://github.com/couchbaselabs/TodoLite-Ionic
If you chose this solution you would have three moving parts. You would be replacing MySQL with Couchbase Server and running the Couchbase Sync Gateway to orchestrate any data between the device and the server. You can still keep your PHP backend if you have a web version of your application as there is a PHP SDK for Couchbase.
Two write-ups on this can be found here:
http://blog.couchbase.com/using-couchbase-in-your-ionic-framework-application-part-1
http://blog.couchbase.com/using-couchbase-in-your-ionic-framework-application-part-2
In the long term, you're going to find NoSQL much more pleasant to work with when it comes to APIs and mobile than MySQL.
Can be useful to write a POST method on the backend that receives the data from your local from the app and some user data (session, access tokens and other thing you considered neceasary). On the body for the request you include the data needed to be synced. The backend takes the body. Parse it and rreturn a result (http code) Based on that you can decide if the app should delete the local data or only mark it as synced on the local database
Total beginner question (apologize in advance for the stupidity :( )
I am trying to learn how to develop apps using ionic framework/angular.
I created a simple news feed (UI part of it anyway).
I then installed MySQL, PHP and Apache on my Mac (MAMP). I have created some tables and inserted some dummy data.
Now, I am completely lost on what kind of routine/procedure to write on my server, and what code to write in my Angular service so i can show the dummy data in my app?
Basically, how do these two discreet "things" on my system know how to connect and exchange data?
I googled it for few days, but most tutorials don't seem to address this basic question.
I don't actually expect somebody to take me through the steps, but if you can point me to some tutorials/resources on this, it would be much appreciated.
Thanks in advance.
You will have to think in terms of web/RESTful services to expose data to your Angular app. I can point you to a couple of introductory tutorials on the MEAN stack (MongoDB, Express, Angular, Node), but you'll get the idea:
Learn to Build Modern Web Apps with MEAN
Mastering MEAN: Introducing the MEAN stack
Several references to online resources, by ericdouglas
Since you are using AngularJS, your frontend app is a single-page app I suppose. All data your frontend app based on is provided by your backend, here is PHP/MySQL.
You need to use PHP to create a REST service to provide JSON data, which can be consumed by AngularJS app. While MySQL is behind your PHP app as a storage provider, it doesn't talk to your AngularJS app directly.
I've one website built in PHPFox. The website is functioning properly. Now the mobile apps for iPhone and Android smartphone are under development which will use the same database that PHPFox website is using.
So, I want to make the existing APIs that are used for a PHPFox website available to the mobile apps (both iPhone and Android) as well. I don't want to reinvent the wheel again and want to re-use the same existing code for mobile apps.
I did a lot of research about this. I've spent almost four days on the research. I didn't get a single link which will explain me how to access the existing APIs from a PHPFox website for mobile apps (iPhone and Android).
One option I found from my research is creating new RESTful webservices using PHP or implement any such framework like Slim, apigility, etc.
But I think following any of the above two approaches will be a overhead and re-usability of code will also not be achieved. If the code which is working fine for website should also be used used on mobile apps. There should be no need to write the same code again. That's what I think.
So using the existing APIs from PHPFox website is the best solution that I think, might be I'm wrong. If you think I'm wrong please correct my approach.
If you could explain with some useful example it would be really great.
I've gone through PHPFox docs as well but couldn't get anything useful which could help me in the issue I'm facing. If you are also interested in documentation of PHPFox please go to below links:
http://unity.moxi9.com/docs
http://unity.moxi9.com/kb
If you could find anything useful related to the issue I'm facing please do let me know.
Well everything you are looking for is already there in the docs. Your mobile app would be registered as an app with PHPFox. You can then use their API. The remaining question is, if the end users need to authorize your mobile app from their "normal" web browser or if this authorization can be performed from the mobile app as well. At least that's what I read from the docs. Since you have an up and running installation at your hand: Just try it! Register an app and perform some requests to their API.
I have a shop project written with Zend Framework 2 and now I want to write an app for this project. I'm new to this whole Android thing (I wrote a few test apps, but no big project like this). So at this moment I'm planning the "app-project" but i didn't find that much till yet.
I have to write the API in PHP and the complete Android app, so I just wanted to ask if someone can show me some good tutorials/sites etc to get more information for this (there are some big topics I'd like to know like security with the JSON communication etc).
If you're building your API in PHP assess first which framework you want to use. I've had success using Yii to build a quick REST JSON API. After getting to grips with Yii this article explains in detail the process of building a REST API: http://www.yiiframework.com/wiki/175/how-to-create-a-rest-api/
You have a few choices in terms of authentication and securing your API. Firstly make sure all data is sent over https otherwise your efforts to secure your API are wasted because anyone listening on your network can read requests/responses in plaintext. Look at using OAuth or a HMAC pattern similar to Amazon web services for authenticating requests. Here's a great article on the latter: http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have had a PHP application developed. I want to use phonegap.com or a similar approach to develop native applications based on the same MySQL database. In other words, connect the mobile applications with the web one.
It needs to do one or two things differently. Firstly, use the native GPS features to determine where a user is - I'm guessing this can just be done via HTML5?
Secondly, send push notifications whenever the web-application user receives a notification.
All of the information is already there, on the MySQL database, and everything apart from the two features above function properly.
I'm am currently having an API developed for everything on the web-application - making it API-centric. In my head, it will be easy to connect the two versions via the API.
For example, a user signs up on the web application. He is then offered to iphone app for download.
Is it possible to get him to log-in with the same via the iPhone. On the other side, is it possible for him to search the database, via the iphone, and "add a new friend" - making the connection of the two users in the friends table - in that, the friend is also a friend on the web-application?
I've been reading a lot on all of the available options and am still very confused! Any help would be very helpful.
I'm not a phone developer myself, however I've just finished building a native Android App which connects to a website and is able to login, do stuff that is possible to do on the website as well. If the GPS tracking integration is using the native features than it is unlikely to use HTML5 (though I'm not sure how it works).
Basically in order to connect to a remote database/server you need to make HTTP requests from the phone to you server side script.
So just to conclude:
In order to achieve the result you're looking for the work-flow could look like this:
1.Mobile user fills a form ->
2.App does an HTTP request to a server side script ->
3.script does the hard work (e.g. connects to the database) ->
4.script renders a result ->
5.Mobile app displays the result.
I hope this helps.
Im my objective opinion there are three possibilities:
Get started with Objective-C
You will have to learn how to code and you will get the best native experience for your users. This will easily allow you to use the GPS positioning or you can cache content on your phone. A key problem with the internet connection on the phone is that the internet connection can be flaky. So you have to design for this. You took the right approach already: using the direct MySQL C-API to connect directly to the database server would not work that well, because this protocol is not stateless. You have to first login to the server and then you can send your SQL queries.
By using your API which is hopefully stateless, maybe even a RESTful API, then you can take some nice shortcuts for your native iPhone app. You could then use the RestKit library to easily convert your JSON answers from the server into objects, do caching and other nice features.
Write a web app
The second possibility would be to build a nice web app using state-of-the-art HTML5 technologies. The great thing about that is that you then would write an Android app as well as both mobile devices use a webkit browser. Well it is not exactly the case as there are different versions of Android out there with different screen sizes, but in general this assumption holds. Take a look at Google's web app for Google Calendar for example, I think it is a good compromise. You can also get a home screen icon for this and you will have no app approval process and can update anytime. Using HTML5 offline storage gives you some degree of freedom.
Using Phonegap
The option of writing the app in PhoneGap or some other HTML wrapper framework which will generate Objective-C code is a possible one, but in my opinion this is not really a good option. The reason is that you are working on some kind of intermediate layer and if anything goes wrong or you encounter bugs you will have to dive down to objective-c anyways. The other problem is concerning updates of iOS. It can break some dependencies and then you have to wait until your intermediate gets updated to use the new features.
Phonegap would be a good idea to develop this app. Phonegap although supports client side script only - which means you cannot embed php in its code. However you can easily create AJAX calls in your script that get and send data from your already developed php app/api.
Phonegap also supports GPS and data storage options where you can store the data locally and sync later when internet is available.
For reverse sync (server to client), you would have two options.
1. Create a javascript to make frequent ajax calls to check for updates.
2. Use Push Notifications (Here a tutorial for iOS APNs and Phonegap integration) - http://devgirl.org/2012/10/19/tutorial-apple-push-notifications-with-phonegap-part-1/
Using phonegap depends on one's preference. On the positive side, you save on time/cost as same code is used for all platforms. On the negative side, it has a slight lag when changing pages causing it to look like a website, but you can avoid that by using something like jquery mobile to prefetch all pages and then animate them back and forth. This will also help in uploading data in a separate independent thread while the user would be free to roam around the app.
Hope that helps.
Simply put, the best way to go is for you to use a php web service with phone gap.
You can also go through android using PHP and android. This is a very good and simple way to go. Try the tutorial here
You may tray Xamarin (part of .Net) with the free version of Visual Studio Community and then interact with your PHP web-app. You can then compile the native Xamarin app (written in C#) to Android and iOS.