Rails3 and Devise working with Iphone/Android/Wp7 applications - iphone

I searched arround for solutions and didn't find anything of really pertinent on the subject.
This is why, I ask you guys your help :-)
Assuming I have an application running with Rails 3 using Devise to authenticate the users.
I need to create mobile applications for Iphone/Android and WP7.
The mobiles applications should communicate/login/create/list, do whatever the website can do.
The mobile Applications could commuicate by parsing the XML .... but maybe there are already lib/frameworks or something more sexy ?
What would be the best way to communicate between my mobile applications and my Rails website ?

I'd use the xml or json output to share data back and forth; For authentication you can set (in initializers/devise.rb)
config.http_authenticatable = true
That enables you to send basic HTTP Auth headers with every request which devise will handle for you.
--
For creating a webapplication that is also possible to view in a mobile version for the website i'd recommend to check out this railscast: http://railscasts.com/episodes/199-mobile-devices

It sounds like, if the mobile app is just an interface to the web app, that you would likely be best served by creating a mobile HTML5 "style" within your web app, that gets served automatically when a mobile phone accesses your website. All of your code can be in Rails, which it sounds like you're already familiar with, and you've also got the advantage of keeping your codebase all together in one place - if you want to add functionality later, you just update your web app, and don't worry about updating 2 different mobile phone apps as well.

Related

What is the difference between web servers (apache,ignix etc) and web frameworks(flask,rails etc)?

Aren't both necessarily the same thing? While frameworks seem to have extra features to help ease development?
A web server is a program that takes a request to your website from a user and does some processing on it. Then, it might give the request to your Rails app.
An app server is the thing that actually runs your Rails app.
See more in http://www.justinweiss.com/articles/a-web-server-vs-an-app-server/

Optimise ASP.NET application IPhone and Android browsers for ASP.NET application

I have an ASP.NET (not MVC) application.
I would like to create a version that is optimised for browsers on the IPhone and on Android.
Some questions
Is it possible to detect IPhone/Android when the site is accessed
Are there any gotchas/tips for developing ASP.NET for these devices.
We're using a combination of .net webforms and jQuery mobile.
For our viewstate, it's been pretty well neutered already so only minor stuff is going down to the device.
Bear in mind that there are around 3 different mobile api's. Each of which has their own drawbacks. You might want to investigate each.
Also, we took the approach that the mobile site was a completely different website than our standard one. When the user comes in, we do some browser sniffing and push them to mobile if it matches with a link to move back to the full one if they want.
Webforms aren´t good for mobile, it generates big pages because viewstate. And you can´t control rendering (some more in .net4).
You can detect device using a db of capabilities like WURFL (I recommend 51degrees) o maybe using some like http://detectmobilebrowser.com/
I don´t know what kind of webapp but you could make a new app, maybe using MVC. Please look this resource.

Can you access the iPhone's address book in a Dashcode-designed web application?

I'm writing a web application using Dashcode. Is it possible to access the iPhone address book from within this web application?
Dashcode is just the development environment IDE for generating widgets and iPhone apps and actually write the apps using JavaScript, HTML and CSS. Any app you make will need to sit on a server and be accessed through the mobile browser on the iPhone. So the question is can you/i connect from a web app to the iPhone native applications. Just from a security point of view i would doubt that this is possible or even desirable,
However i have seen suggestions that a native application in x-code could be built that would have a web interface that would be able to talk to the browser but i am not sure how you would engineer that or if it would work.
I suspect a simple solution is to sync your iPh=one contact with Gmail, or similar web app and then access it or write your own server that you sync contacts to. However this is not a general solution i suspect.
Hope this helps even though it is not the answer.

Creating iphone & android apps for existing rails app

I've just spent a lot of time looking into the best ways to create iphone and android apps for an existing rails app that I've built and I feel that I haven't actually gotten any closer to knowing how to best achieve this.
What I want:
I would like to have the rails app and the mobile code cleanly separated. I'm not looking to just render a different layout in my rails app. I'd prefer to use something like phone gap that allows me to use roughly the same codebase to run the mobile apps.
I'd like to have offline/sync capabilities in the mobile apps (hence if a user creates a record on their iphone while they are out of coverage the app should save the record on the phone and continue to try to to sync that record to the web app until success.
Having access to the hardware features will be needed down the road. GPS, accelerometer, etc.
My questions:
Is this a good situation to use oauth? Would I just build an oauth provider into my web app and then build the two mobile apps as clients to the web app?
Is there an easier method for secure authorization that I'm missing?
Does Devise work with oauth? My app is built on top of devise at the moment.
Is this syncing something that should be abstracted to a middleware or metal?
Sorry, I know this is actually a lot of questions but I'd like someone who is familiar with the situation to answer in a comprehensive manner rather than just a couple little pokes that leave more questions. I feel like this has to be a common situation now-a-days but I can't seem to find anything up-to-date in my searches.
Cheers!
ps. - If you've done something like this yourself and know how to pull it off, I'd love to talk to you directly. I'll even buy the beers. Seriously... no takers?
I am building a mobile application with a grails backend, must support android and iphone
I have done a few iterations so far while attempting to settle on technology, a native objective-c, native android, phoneGap and titanium appcelerator.
for authentication I use HTTPS with basic auth. I know people are concerned about basic-authentication, but it has been argued both ways see this StackOverflow Question
I have not solved the syncing problem yet, but I dont expect to implement that complex of a solution initially, will store local content (XML or JSON) and push back to server on demand. Content is stored locally in same format used when posting to server
Backend in grails, all REST API calls are logged and authenticated on each request. Will probably add additional security only allowing specific registered devices to access the API as and additional level of security
I've been building a iPhone app with a Rails back end. I've been using Objective-C because it needs the full Core Location framework which isn't available with a browser based solution. So if you want to use the full capabilities of the device, you have to use the native development environment.
I've been using Objective Resource http://iphoneonrails.com/ which is an open source framework that provides Active Resource-like extensions to Objective C NSObject classes and plays very well with my Rails App. You just have to put in render JSON or XML for your controller actions like in the example below.
class UsersController < ApplicationController
# GET /users
# GET /users.xml
def index
#users = User.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => #users }
format.json { render :json => #users }
end
end
I don't if this answers all your questions as I don't know enough about your app but it's a good starting point.
Maybe you will find useful my example rails + ember.js App with token authentication based on ember-auth and several OAuth strategies. It is responsive and works both as a desktop and mobile App with Phonegap.
Currently in de the devel branch: https://github.com/joscas/base_app/tree/devel
Life here: https://starter-app-staging.herokuapp.com for the desktop version.
It uses the phonegap-rails gem (of which I'm also the author) to export the apps assets, fix paths etc without hassle.

iPhone apps and state aware web connections

I'm working on an interface for an existing web application that will allow iPhone and other mobile clients.
I have started implement a JSON API and I need to give some detailed specificaitions for the App to an iPhone developer.
What I am curious about is whether other developers are using session data in their JSON / mobile client communications.
Do the common url grabbing libraries of iPhones (and other mobile devices) mimic a browser's cookie handling?
Can someone suggest what libraries might be used to achieve this? Are there any online tutorials or blog entries that outline state based web connectivity in an iPhone app?
I've used ASIHTTP (http://allseeing-i.com/ASIHTTPRequest/) and JSONFramework (http://code.google.com/p/json-framework/) to achieve this.
Both very good libraries that are easy to work with.