Bidirectional communication between Adobe Air Apps - php

This whole thing started when I began working on an Adobe Air App that was until now a completely single player game. The question I have is whether it is possible to alert a user when it is their turn without using a polling technique ( without continually checking... is it my turn yet? ). The technologies I have at my disposal are pretty much just AIR, PHP, and MySQL. I currently have a shared hosting package with no ssh support in which I am sure I will change soon this year to a dedicated package with ssh support.
With these technologies would that be possible?
The idea / direction I have been going down is.
Setting up a PHP Socket Program to maintain the connection between users and having a common domain the AIR application(s) will connect to. For example. My phone would POST to my.domain.com which would execute a php script to start a Socket Server "exec("php /socket.php"); All users of the application would join a "pool" in the server if it was running in which - my theory is that - I can maintain bidirectional communication with them. The MySQL server can be used to track if the socket is open and who is currently in the pool. Is this possible?
I also think I would not be able to notify users when the app is closed as they would no longer be in the socket.
I'm just wondering if I am way off base here.

If you want to use existing notification ANE, you can get it from here :
ANE-Push-Notification
It works for both IOS and Android.
And if you want to start from scratch, this link is also useful :
Developing Native Extensions with Adobe

After a lot of research, and reviewing many alternative technologies, both ios and android offer native support for notifications to be sent to another device. I think the best option is to build an air native extension or find one that already exists to bridge the gap between the andriod or ios notification system. Here is a good resource to get started http://www.adobe.com/devnet/air/native-extensions-for-air.html

Related

can a regular webhost and a separate node js server communicate?

I'm currently working on a trade / social network site as a side/learning/fun project.
At the moment I have an sql database messaging system. I want to create a live chat system like facebook which can tell the user is online, typing a message and everything.
I did some research into this and figured I need to start learning to use node.js and websockets. I called my webhost and they said they don't support node.js. I like the tools I'm using and do not want to migrate my website.
I also looked into some info about CORS.
I was thinking of a solution: client as well as the php server also communicates with an external node.js server using jquery to handle all chat and notification requests. The node.js server will also store messages in the php servers mysql database.
Is this solution feasible and am I on the right track? Or is there a better way?

Create custom Audio/Video chat server using WebRTC for iOS?

I have been studying WebRTC from last 2 days but couldn't understand how to develop and stand up a server based on WebRTC for iOS.
I really don't want to use any 3rd party Audio/Video chat service providers in my application even if they are WebRTC based. I want to create my own WebRTC based custom Audio/Video chat.
I just need a startup guide for developing WebRTC based chat server.
Couple of things:
You will have to work with the NativeAPI and compile for iOS, this tutorial should help, this is for the iOS client side only.
If you chat is only one-to-one a simple websocket or socket.io with node.js for your signalling server should be simple enough
If you want numerous parties in the same chat, you will either have to handle all the individual connections(numerous individual peer connections for each device connecting) or implement a type of MCU, licode is an EXAMPLE of such
Those links are just examples of how people have done similar things before, you should not have to utilize their libraries or their solutions. But, you WILL have to use the WebRTC Native API, handle numerous peerconnections for each client(or create your own MCU server), and handle the signalling between each client(for connection start up and tear down).
You can also try Icelink api provided by Frozen mountain
They have provided free trials for iOS, android , web client, windows phone.
Also they have provided their own turn and stun servers which can be only used in windows server 2013. Overall library is very well documented and easy to use.
You need to register yourself to download the api, which is free of cost.
Hope it meet your requirements.
Good luck

How load PHP website on the iPad simulator or device?

I have one .php web site and I want to put it in iPad application "web application".
I mean create UIWebView and load files in WebView, so my First question is, is it possible to create this webApp and can I run it on Xcode simulator?
What do I need for implementing this application (Apache, MySQL) inside ipad outside?
Basically I want to have all my .php class inside of app and run it via iPad app, it means that if I hadn't any internet I can run the application.
Since I want to run it in both iPad and XCode simulator.
Would you please give me some hints for implement this application?
A few points you need to think about:
App Store Approval - if you intend to market this app (i.e it's not for jailbroken devices via Cydia, or an in-house corporate app) then you will most likely run in to issues with the approval process.*
You're intending to bundle in a scripting language with your application. Now this may not be an issue depending on whether or not this is exposed to the end-user; but you do run the risk of Apple finding out and pulling the plug.
The alternative to bundling in a scripting language (PHP in your case) is going to be loading the code off of an external server. This is a no-no straight away, as Apple requires your application to have functionality offline - or atleast they did. Where this leaves all the Social Networking and other network-dependant apps... Well, I guess there are exceptions!
Device Performance - you're essentially intending to run a small web server on a mobile device; a tablet in this case. This could be very resource intensive, so is probably not wise. I personally wouldn't want my battery being drained because someone has decided that they want to bundle in a web server with their application.
Your implementation idea itself is sound, in the respect of using a UIWebView. You should probably check out the Apache Cordova/PhoneGap framework, and that should satisfy your needs and provide an off-the-shelf way of packaging up your web app. If you do need custom functionality then it's worth looking at anyway; plugins are relatively easy to develop, there's a wide range available already and the plans for cordova now are to allow developers to implement it into native applications. (Say, if only one view requires PhoneGap functionality etc)
Personally, I fail to see what requires PHP that can not be done via HTML5 and PhoneGap. There are storage options available, SQL options, you're using web technologies so can easily query external web services. It's also a lot safer with regards to app approval - as it's tried and tested; there are many applications build using such solutions already in the store.
I think you need a serious re-think. Otherwise, perhaps you could post some more details?
Please note that PHP is a server-side language. So do you want to run a server on your iPad? If so, you can develop PHP applications on a proper desktop/laptop and then view them on iPad Safari browser over Wifi.
Otherwise you can install LightHTTPd server with PHP libraries, MySQL, CURL and all from Cydia app store on a jailbroken iOS device to get a full environment. For Android there is this app PAW server available which can run an Apache server in such devices.
If you just want to check your website is working fine on small devices, or you want to check responsiveness of your website. Go to:Ipad Peek and run your website on given devices/simulators using url.
A simple google search pulled up this free framework: http://www.ipfaces.org/
I've never used to before, but it might do what you need.

Is it possible to access (read: query) an xml data service provider (REST or SOAP) directly from the command line? If so, how?

Please forgive the novice-ness of this question if this is in fact a novice question, and maybe if it doesn't exist it could one day, but thank you for your time already. I'm just trying to learn how to access dynamic data for my website.
If these (command line accessible) services do exist, which I imagine is doubtful, I am looking for dynamic (externally stored) Finance & Economic data providers.
EDIT: Ah! Great.
- I run both mac osx lion and windows vista on separate computers. I like ruby on rails, and the startup I'm working with uses php so that's OK too. Other than that as far as verification processes go, honestly, I'm not that far yet. The data I'll be trying to access at first will likely be open source (free for academic purposes, etc) and come from Google or Bloomberg Open if that helps. Thanks already though
- Ruby on Rails runs extremely slow on Windows so I'll be using Mac for the most part.
EDIT: Are there any IDE's (or IDE plugins) which have the capability to do what Alexei is describing?
EDIT: I'll probably be trying to access Google Docs via a REST API for my starter app. But am still interested in trying to access it and any other REST source via the command line and/or an IDE!
The curl command takes a URL as its argument and issues an HTTP GET to get the resource at that address. If that HTTP request accesses a REST web service, then it displays the response from that service. You can of course build on this as your starting point.
REST/SOAP services are accessible by issueing HTTP requests. There are plenty of tools to do just that on all operating systems. Starting from telnet for barebone communication to scripting languages that provide parsed responses like Python/Ruby/JavaScript for most platforms, PowerShell scripting would be probably the best for Windows environment.
To get more specific recommendations you need to get more details in the question (OS, languages you like, authentication used by services...)

Building a native mobile application - based on a PHP web-app [closed]

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.

Categories