Create Android application for ASP.NET MVC 3 application

Go To StackoverFlow.com

2

I have already an ASP.NET MVC3 application and I want to develop an Android application for it, what are the options that I have?

After some research I figured I might:

  • Make a native Android app that uses the controllers in the MVC application. To use this I will need to add methods in each controller to convert the data into JSON so I can send to the Android app.
  • Forget about the whole ASP.NET application and try to connect directly to the SQL server from the android application. I know I need to write an intermediate ASP.NET code to communicate with the database.
  • Create from the MVC application a mobile web views and use it in the Android application. (I don't know if that is possible and how to do it).

Is any of these options valid and what other options is there? which is the best way to do this?

2012-04-05 17:34
by Kalaji


2

Another option is to could create another MVC app or area that contains controllers for data access specifically for use with the app.

I know you're using MVC3, but you might want to look at MVC4 web api for an example.

Best practice says that you should have some kind of service layer between your app and the database, so I would eliminate the second option from your list. The other two options are viable though.

2012-04-05 17:41
by Kyle Trauberman
This option will be time consuming. And I've seen some awesome stuff in MVC4 but turning to it is not an option for me. If I'm to create another MVC app, how can use the same database. Do I only import the mdf file - Kalaji 2012-04-05 17:49
@Kalaji I'm not suggesting migrating to MVC4 -- I merely mentioned MVC4 web api as an example - Kyle Trauberman 2012-04-05 17:50
I edited my comment above - Kalaji 2012-04-05 17:51
@Kalaji How are you connecting to the database now? Are you using SQL Server, or attaching a db file? If you're connecting to another SQL Server, just include the same connection string in your web.config - Kyle Trauberman 2012-04-05 17:56
@Kalaji I would recommend just creating a new area in your existing app though -- it will save you time and headache, and allow you to use the same model/data classes as your existing app - Kyle Trauberman 2012-04-05 17:57
The app was auto-generated from the ER diagram, so I guess the database is attached as .mdf file - Kalaji 2012-04-05 18:08


0

You can utilize either jquery mobile or KendoUI (if you feel like paying for the license, it's a great product suite) to help with developing an HTML5+Js only application that connects to data provided by your MVC project as JSON data.

Once the pure html+Js app is written, you could use PhoneGap to compile it into an app for Android and iOs both.

2012-04-05 18:20
by Ron DeFreitas


0

If you have already deployed your MVC app you can follow what @Ron said. What you can do is to create an html5/html page which embed your live mvc app using iframes, then use PhoneGap to deploy your application.

However if you want to deploy your android app to google play you will need to sign your app. Follow this link: https://github.com/amirudin/build/wiki/Android-Signing for step by step tutorial on how to sign your android application.

2014-05-18 09:16
by kingsley sithole
Ads