How can I connect android to mvc ? For example I want to open my camera via google chrome, how can I control it ? People telling me to use json is that true ?
Your question is a mess.
It sounds like: I want to send a rocket to the mars people telling me that I need oxygen is that true?
Below I'll try to clarify what you need and what you want:
You need your own android application that can open camera by
server application request.
You need your own server side ASP.NET application.
When somebody opens a web page on your ASP.NET your server app should some how to establish a connection with an instance of your android application and tell it to start capturing of media-stream from the camera.
You want to send media stream from your android camera to a desktop browser
Answer:
You can use JSON as well as any other data-interchange format at point 3.
But keep in mind that your data should be transferred by some data transfer protocol - most probably HTTP.
At point 4 to work with media in a browser have a look to the WebRTC.
Kind of. Looks to me that you should explore the world of APIs in general as you are not too familiar with them. By the way a REST API is a good way to go, but you'll need a platform, a "server" to do it.
Then you will be able to control your device from a remote one.
Related
I've been reading some info about Web Services for Android using SOAP or REST but I've never created a web service so I have many questions about this.
I'm developing an Android App where the users answer some questions and for each user an XML file is generated and saved in the device.
Here are my queries:
What I would like to do is to send these XML files from the devices to the Web Service and also sometimes to retrieve all the files to any
device.
Do I need to convert these files into Byte or just send the XML?
Are these actions possible with the Web Service or will you use Java Sockets? In case you prefer the Web Service, what would you use:
REST, SOAP.
I would appreciate some links to tutorials and piece of advise.
Use SQL Server to manage the data on your desktop and create a web-service in .NET on Visual Studio.
Then connect to the web-service in your application and set/get data from the DB, using web-services. You can use either XML or JSON to transfer your data between the phone and the server.
There is no need for the use of Java Socket API for this.
Links which might be useful :
How to make a web-service in .NET (does not include the implementation in Android) : http://srikanthtechnologies.com/blog/dotnet/wsdaljava.aspx
How to connect your service with Android :
http://seesharpgears.blogspot.in/2010/11/basic-ksoap-android-tutorial.html
http://www.codeproject.com/Articles/304302/Calling-Asp-Net-Webservice-ASMX-From-an-Android-Ap
http://adrianandroid.blogspot.in/2012/05/access-c-net-web-service-in.html
Note: I have never worked on RESTful services. My work has always been on SOAP and hence it remains my preference.
Your final choice of how, exactly, to architect your app, is going to be based on all sorts of things that you haven't included in your questions: your experience, the experience of the other developers in the project, so on and so on.
I will say this, however. REST is deep in the heart of Android. If you decide to go with REST and, possibly, JSON instead of XML (there is, almost certainly, no reason to use byte arrays), you will find that Android's architecture supports you. SOAP and such and you are on your own.
I just want to make a TV guide for Android and later some other Mobile Platform. I want to use an RSS updates to update my application. In this specific scenario I want to use http://tvprofil.net/ 's RSS resource. I thought that I could just call site's RSS XML from my Android app, parse it, show, and thats the end of the story.
But, my cousine told me that the best way to do things is through Asp.net Web Api Service. Something to deal with REST. So, If I have to change resource, to like some iptv provider's RSS I would just change the Service and not have to deal anything with my mobile application. Other advantage, he said, is if I want to build Windows Phone application or iOS aplication that works the same way, I would have that same service to do job for me and just create UI and basic things for those apps.
The problem is that I have no idea how Asp.net web Api is used.
Can anyone give me some usefull link, or even better, write an example of this thig. I just want the RSS from http://tvprofil.net/ to go through Asp.Net Web Api Service and that I can call service and get it as XML or ... even Json... or to get anything at all to my app.
The whole thing is pretty confusing to me
If a RSS feed has enough data for your application to function then you do not need ASP.NET Web Api. The only role ASP.NET Web Api could play in this scenario is if it acted as an intermediate. E.g. your client application contacts your server application (ASP.NET Web Api) which in turn pulls the data from the actual external data source (tvprofil.net RSS).
For completeness sake, a list of pro's and con's:
Advantages of using an intermediate server
Reliability. You can cache the data of the external data source and serve that data even while the external data source is offline. Also, by caching the data you can lighten the load on the external data source to a bare minimum.
Transformability. Your intermediate server can translate the data of an external data source to another format that is more suitable for your client application. This is useful when you have many external data sources that each serve data in another format. Your intermediate server acts as a layer of abstraction for your client application.
Disadvantages of using an intermediate server
More effort. It will take more effort to develop and host an intermediate server.
Reliability. You must ensure your intermediate server is online and connected to the internet 24/7
I am going to create game for android, this game has multiplayer mode, so it should send ang get some data from server.
Lets assume that 5 players are playing this game.
Each player on his turn sends a word to server, server checks if this word is correct and then server sends this word to other players.
Also server has some kind of timer, and when times goes out it sends to all player then time is up.
Very simple.
Now what is my problem. I have never done web programming and I don't know how to implement server side. Google gived me several options:
Http server
Sockets server
What should I use? One of this options or something else?
Also what frameworks/libraries can be helpful in implimentation? I'd prefer python (like CherryPy if http server is good for my purpouses), but also I can do it on java or c++. Or on php (but I don't want to use it)
Update
After thinking for a while I used python tcp socket server. It seems to be most lightweighted solution for my needs. Also it is easy to interact with it from Java.
Consider using Twisted Python and roll your own simple protocol using persistent connections.
Alternatively, use a normal HTTP(s) server like Apache or nginx and WSGI to tie in your python backend logic. To make it appear as if you have a persistent connection (used to notify everyone of the "word" that was submitted or the expiration of a timer), you'll need to use something like AJAX.
Have you considered using parse?
https://parse.com/
Another good option I like is NodeJS, however you will get alot of the same benefits such as Asynchronous Concurrency from Tornado (Python)
My project is create application on android. It can get a location(latitude,longitude) via GPS.After that I want to send a location to a server or web server to collect for calculate a distance which are draw on my own map(may be make from Flash) on a website.
I knows an android have apache, but I don't really know in detail about server, web server, apache.So, I want to know how to send a location from my application to server.
Anyone can help me or suggest me?
Appreciate,
Daisy
PS. I'm a newbie.
If you're writing both the Android part of the application and the server part, then you can decide how to transmit the data. You could go with some simple JSON like:
{"lat":12.34,"lng":56.78}
No reason to come up with anything more complicated than that if you don't have to.
I don't think its necessary to have apache server on server side,
AFAIK> android can ping to any web service on any web server. I can ping an asp web service that can be hosted on IIS.< AFAIK
You can ask the developer of that site to develop web service (api url) that can accept latitude and longitude as parameter (or search the api if they have one (a la google maps case)) and you only have to care about calling that web service.
I'm new to Android and web service development!
currently I'm working in developing Android program that will send longitude and latitude information to asp.net website (to show the location change the website map)
the questions are
- how to send this data to the website (the best practice)!
- any suggestions for a suitable framework starting from the android application itself , inserting to database , client/server connection !!
I've read a lot about web services specially REST ..but didn't find tutorials
Appreciate your kind help..
I would suggest that you use JSON to encode your data and this will allow you to use any implementation (pretty much) on a server to receive it. I prefer Java/Servlets but you can most certainly find a JSON library for ASP.net etc. Using something "standard" like JSON allows you more flexibility in the long run than doing something custom.
Have a look at this question for some example code to get started (for lat/long): Passing GPS LonLat from Android GPS to WebPage (javascript)
I also suggest that you use POST instead of GET when using HTTP, there is some example Android code here: http://www.anddev.org/doing_http_post_with_android-t492.html and http://www.androidsnippets.org/snippets/36/
Lastly if you need security and you are using HTTP, simply add an SSL certificate to your server and you will then have HTTPS.