How to build an android app using MVC 5 and Web API? - c#

I have an application developed in ASP.NET MVC 5 using EF6. My client needs some forms of that web app and reports on an android app. I just learnt that using ASP.NET 5, one can develop cross platform apps. How can I use my existing MVC 5 controllers,views and models with Web API to make an android app?
I have no experience with asp.net 5 and android development. I have studied a bit on internet that if I expose my data via RESTful API then I can make an Android app.
Regards.

Any web application or service can make functionality available via REST API. This basically means that you can control it and get data via GET, POST and other requests.
This means that it will be very difficult for you to expose anything but data, like controllers or views.
Since with the REST web service your app would need to be online anyway, you could just wrap your website inside an android app, similar to what BNK said or using other technologies, like a native view - should not make much of a difference.
Then basically, you have your web site (or a modified version thereof) hosted inside an android app.

Related

Cross-platform development using .Net Core Web API as the backend service, Angular and Ionic or React (ReactJS, React Native) and ElectronJS?

I would like to have an opinion from you guys at Stackoverflow, as I am struggling upon which front-end framework or library should I choose for my projects:
1 desktop application, 1 web application, 1 android application, 1 iOS application,
Prefer to have one-single-code-to-rule-them-all-for-the-frontend-framework.
as for the backend server side, I would choose .Net Core Web API.
What I have searching through the internet, I have found:
I heard that Angular and Ionic makes a great combination for the development of Web, Desktop and Mobile, or Angular alone is enough as the front-end framework to build Web, Desktop and Mobile, while for the backend will communicate through Angular directive to the .Net Core Web API. What do you guys think about it?
I also heard regarding ReactJS (Web), React Native (Mobile) and ElectronJS (Desktop), and have a question: is it one-single-code-base-to-rule-them-all-across-platforms (Web, Desktop and Mobile) , as well I heard that ReactNative have to build separate views for Android and iOS?
Which framework or library that is suitable for me to develop on?
I know that it is based on me to choose from, however I need to hear from you guys as I am a single developer who will works on those platforms (so I prefer one-code-to-rule-them-all)
Your answer much appreciated.
Thank you very much.
Well everything here in the software development community is about needs!.
If you're going to be alone, should be good to do something with the most common framework to you.
Ionic can be used for web, mobile and desktop.
Have fun coding!.

Two way web service communication in wpf

I have a WPF application that needs to send and fetch data to and from a web application. Web application is built using ruby on rails.
What's confusing me at the moment is does the WPF application need to have a web/wcf service on it's own to talk to the rails web application web service. If not how can i fetch and send data to and from the rails web application web service.
Please note that I have done some digging around google and here but am still confused since most of talk of creating a asp.net application first. A step by step best guess scenario/example would really be helpful.

Building a REST API for mobile apps(Android & iOS) for an C# asp.net ecommerce website

I am new to APIs development and have to start building a REST API for the e-commerce website to be built and can be used by 3rd party: mobile app development company.
The eCommerce site is written in C#, ASP.net.
I have read about SOAP, REST, RESTFul on google.
My doubts are :
Where do I start? I have never created any API's before. Please mention the steps to start over.
The REST API is to be used with both Android and iOS mobile app. So, do we have to create a different client application for both?
Do we use some frameworks? If yes, then which frameworks to use?
As the website is written in dot net. Do we use Java or dotnet for REST API development?
What is the best way to create the REST API for mobile apps?
Please help me with my doubts.
Thanks in advance.
Here is Tutorial to build RESTFUL API in .NET.
My knowledge is in ASP.NET so I leave the Java guide for experts in that field.
RESTful API provided by Microsoft - which is called Web API - is a part of ASP.NET MVC, so you should start learning ASP.NET MVC, it's pretty easy for ASP.NET guys to learn ASP.NET MVC.
No, when you developed your Web Service, both iOS and Android would be able to communicate with your Web Service.
For Authentication, you gonna need libraries like Owin.
Since your main website is in .NET and not MVC, you should keep the Web Service files separate, for this, you can put Web Service file in a separate folder on the same host which the main website is, then create a sub domain to access the Web Service. By the way, you can create your Web Service using Java too, since it is separate from the main website, it makes no difference which technology you use.
The best way to create a REST API for a mobile app is if it is done by an expert! ;) There are many tools and frameworks out there that can be used to create RESTful Web Services, each one of them has some pros and cons, I prefer to use the one I know the best, which is Microsoft ASP.NET Web API, you should choose based on your current expertise.
P.S. If you gonna start learning ASP.NET MVC, I recommend to learn ASP.NET Core, which is the latest version of ASP.NET MVC, and is the future of this technology.

Running web-application offline on android

A while ago I created an ASP.NET MVC Web Application for android devices. The application also used jQuery mobile to set up navigation etc.
At the moment, the application is simply being hosted and the androids webview accesses it that way.
The application works as expected, but I was wondering, is it possible to store the MVC web-app on the phone/integrate it into the apk?
I would like to be able to have it run the web-pages while the device is offline. I know it is possible to run simple HTML in the webview but I haven't been able to find anything about something like an ASP.NET MVC web-app. Is this done using phonegap?
Thanks.
I don't think you can do it directly with PhoneGap, from the PhoneGap FAQ
Q: Can you use PHP/ASP/JSF/Java/.NET with PhoneGap?
A: A PhoneGap application may only use HTML, CSS, and JavaScript.
However, you can make use of network protocols (XmlHTTPRequest, Web Sockets,
etc) to easily communicate with backend services written in any language.
This allows your PhoneGap app to remotely access existing business processes
while the device is connected to the Internet.
So if you are going the PhoneGap route, you'll have to write it in HTML/CSS/JavaScript. However if you more comfortable in .NET and C# then there is always Xamarin Android which has a free starter version that you can try out. Do realize though that if you go that route it will be a mobile app and not a wrapped ASP.NET app.
If I understand correctly I think what you want to do is serve your data via a web service (MVC4 web api is pretty simple to setup). Then you'd consume that data with your android app and you could more easily cache that data for offline use.

Kendo + Web Api vs. MVC vs. Web Service Where to go?

I'm just starting a project where I would like to use Kendo UI (based on jquery) with C#. A few weeks ago I was successful in handling requests using Web Services (asmx), was pleased with the results and performance, and was able to create forms quickly.
Since this is a new project, I thought I could look into different concepts such as MVC and WebApi. I found MVC to be the most complicaded so I went for WebApi and started playing with controllers and requests. So far what I'm finding (don't judge me, I'm new to these new concepts), is that Web Service seems to be simpler and more flexible.
So I guess what I'm looking for is... what are the main advantages of using MVC vs WebApi and even vs Web Services. Are there any downsides to Web Services? Would it be a bad practice to have my data layer controlled by Entity Framework, all models defined, and my requests handled by Web Services?
Any clarifications are welcome. Thank you.
In a broader sense, Web API is used to create Web Services ! It uses HTTP as its standard for creating services (instead of SOAP like in asmx) as its more open and any type of client like a mobile app, desktop app, web app etc will understand HTTP protocol. Another advantage is that u can easily use JavaScript/jQuery to communicate with your Web API. With SOAP web services, its a nightmare!
Kendo UI and Web API is a great combination. We have recently created a mobile iPad app using this combination and it worked like a charm. We also used Entity Framework with oracle as back end DB and it never gave any issues.
Webservices are nice if you have the need for it. A need as in needing that logic/data in more than one different type of application (such as web, and a mobile app, and a desktop app). (Or if you want to sell the service you're providing)
Using a webservice for ONLY a website which you don't except to expand to other things is complete overkill.
Furthermore, the MVC framework and the Web Api framework are pretty similar except web api is used exclusively for webservices. Coding in both of them will be the difference between white bread and wheat bread.

Categories