如何将数据从Android应用程序发送到asp.net网站 [英] How to send data from an android app to a asp.net website

查看:96
本文介绍了如何将数据从Android应用程序发送到asp.net网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一种员工跟踪应用程序,其中任何外出参与公司实地工作的员工都可以通过将他的经纬度地理位置以及他的emp_code发送到网站来提供他的出勤率。收到此详细信息,管理员将能够在地图上查看他的地理位置。请任何人帮我这样做!并告诉我数据库和哪个数据库将如何在这个应用程序中发挥作用



我尝试过:



我是Android和服务器通信应用程序的新手。我为此做了所有基本用户界面,但坚持实际工作

I am trying to develop an application of employee tracking in which any employee who is out for a field work of a company can give his attendance by sending his geo location that is latitude and longitude along with his emp_code to a website and after receiving this details the admin will able to view his geo location on map. Please any one help me to do so!!! and also tel me how database and which database will play its role in this application

What I have tried:

I am new to android and server communication application. I did all basic UI for this but stuck at actual working

推荐答案

您可以使用Android API中的HTTP客户端将详细信息传输到在线服务器。 ASP.NET网站或Web应用程序是一个很好的在线资源,您的Android应用程序可以在其上共享数据。



Android文档本身提供了连接网络的基本文档,连接到网络| Android开发者 [ ^ ],您很可能会理解如何轻松地进行这些通信。



您还提到共享位置,我刚刚有一篇文章,其中应用程序将捕获位置然后通过SMS共享它,您可以使用HTTP协议。阅读这篇文章, Ok Android,Broadcast my location! [ ^ ]。该应用程序讨论了使用Android中的Location API请求和捕获位置的方法。



您可以删除SMS功能,而是使用HTTP服务将数据发送到网站。 ASP.NET网站将根据需要处理请求并存储数据。



HttpURLConnection | Android开发者 [ ^ ]
You can use the HTTP clients in Android API to transmit the details to an online server. ASP.NET website or web application is a good online resource where your Android application can share the data on.

The basic documentation for connecting to the network are provided on Android documentation itself, Connecting to the Network | Android Developers[^], and chances are that you will understand how to do these communications easily.

You also mention sharing the location, I just had an article, in which application would capture the location and then share it through SMS, you can use HTTP protocol. Read that article here, Ok Android, Broadcast my location![^]. The application talks about the methods used to request and capture the location using Location APIs in Android.

You can remove the SMS functionality and instead use the HTTP services to send the data to the web site. ASP.NET web site would handle the request and store the data as required.

HttpURLConnection | Android Developers[^]


将数据从Android发送到Asp.net的简单方法和使用kso​​ap2和webservice

以下是一些代码示例:



easy and best way to send Data From Android to Asp.net to Use ksoap2 with webservice
Here is Some Code Sample :

public final String SOAP_ACTION = "http://tempuri.org/HelloWorld";

   public  final String OPERATION_NAME = "";

   public  final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";
       final String SOAP_ADDRESS ="";

       Log.d("errors",pid+" "+lat +" "+longs);

       SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
       PropertyInfo pi=new PropertyInfo();
               pi.setName("pid");
               pi.setValue(pid);
               pi.setType(String.class);
               request.addProperty(pi);


               SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
               SoapEnvelope.VER11);
                       envelope.dotNet = true;
                       envelope.setOutputSoapObject(request);
                       HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
                       Object response=null;
                       try
                       {
                       httpTransport.call(SOAP_ACTION, envelope);
                       response = envelope.getResponse();
                       }
                       catch (Exception exception)
                       {
                       response=exception.toString();
                       }

       return response.toString();


这篇关于如何将数据从Android应用程序发送到asp.net网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆