Android :: How To Send String To Server
Aug 30, 2010
I am trying to send a string to server, i would like to know how many alternatives i have. Actually i am using a socket but i don't know if there is a better option. The string is big(lenght about 192000 , yes too much 192000), i think is a little is stupid try to do this, but the server works with sending a string to one computer to other computer and my mision is to make a conection between a computer like server with a client (android phone). If i can send i big string so i do not need to change the program on the server. I need info about how to send a string with 1. GPRS EDGE 2. Wi-FI
View 14 Replies
Oct 27, 2010
i am trying to send a json string from my android client to my .net Rest service...
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("http://myURL");
JSONObject json = new JSONObject();
json.put("name", "i am sample");
StringEntity str = new StringEntity(json.toString());
str.setContentType("application/json; charset=utf-8");
str.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/json; charset=utf-8"));
post.setEntity(str);
HttpResponse response = client.execute(post);
Response is bad request. am i sending the json object as string? is this code correct?
View 2 Replies
View Related
Feb 3, 2009
I want to send the some xml data to server. Here I am showing you the example I tried: try { String s = "<?xml version="1.0" encoding="UTF-8"?>
" +"<name>Manoj</name>
" +"<number>123</number>
" +"<school>dmh</school>
"; String url = "http://localhost:9090/loggerapi.php?data="+s; HttpClient httpclient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(URI.create(url)); httpPost.setHeader("Content-type","text/xml; charset=ISO-8859-1"); ResponseHandler<String> responseHandler = new BasicResponseHandler(); String responseBody = httpclient.execute(httpPost, responseHandler);
}
View 2 Replies
View Related
Nov 18, 2010
I am developing a GPS application.. By using the windowsXP OS and eclips IDE. I am able to get the Longitude and Latitude of the current Position I want to sent those details to server by using the Http connection and for that sending, I will use gprs connection in my device how to do this, I am in big confusion. Here one more thing that GPRS connection is not available at that time we need to sent a SMS to the server.
View 3 Replies
View Related
Aug 11, 2010
In my application, I need to record some file. I want to send audio data to server while recording. Do you know how to do that? After user stop saying, I need to detect the end of speaking. Is there any algorithm to do that? I want my application similar as google voice search,
View 6 Replies
View Related
Sep 21, 2010
My application needs to record audio and send audio data to server while recording. If User stops audio input, we will stop sending. How could I implement such feature in Android?
View 8 Replies
View Related
Sep 2, 2009
How to send the Url to the server using Http Get method...Here i m trying to insert a name into the databse .If i execute the below showing code there it tells "Connection to http:localhost refused " I think the error is is in the Http method..how to Correct it....
CODE:...............................
View 2 Replies
View Related
Nov 4, 2010
I made a simple Android application which gives the latitude and longitude of the place where I am via GPS and I want to send the coordinates to a Webpage and represent them on google maps. Which is the simpliest possibility to send the data to the server?
View 2 Replies
View Related
Apr 6, 2010
i am new to android. I want to connect with server. Like i want to sent data and receive data from server through Http Connection. Can anyone help me how to do this. Can anyone provide me the sample of both side-client as well as server side.
View 2 Replies
View Related
Feb 15, 2010
Usually, I putExtra inside an Intent to transfer stuff between Activities. But it seems like I can't do this with a Service? Bundle extras = getIntent().getExtras(); That doesn't work for a android Service. How do I send a string from an Activity to a Service then?
View 1 Replies
View Related
Nov 2, 2010
i am trying to get an android app to send tcp data to a server on my network. The server was written in c#. When i use the code below to transmit data, the server only receives a whole series of.
Socket socket = new Socket(host, port);
PrintWriter pw = new PrintWriter(socket.getOutputStream(), true);
pw.print("test");
socket.close();
View 3 Replies
View Related
Mar 20, 2009
We are workin on a project, in which we need to provide the facility of chatting betwn users, for that i need to poll the server countiniously to recieve/send the chat msgs.Does anybody know how to do it.
View 2 Replies
View Related
Aug 16, 2010
I want to save the data on the web server. I have data in XML format and I know the URL String. Please tell me how can I send the request and handle the response.
View 1 Replies
View Related
Aug 23, 2012
i want to develop an application which send user's location to server. My server is tcp i dont know how to send location from emulator to server and how server receive it
View 1 Replies
View Related
Mar 11, 2012
I am trying to send the Acelerometer and GPS data to the server every 5 minutes.
View 2 Replies
View Related
May 5, 2010
does anyone know how to get result from subactivity to MainActivity without close the subactivity? i know the usual way is using method called "startActivityForResult (Intent intent, int requestCode)" and inside the subActivity set the result 1st before finish(); method
setResult(requestCode,intent); finish(); then the function called "protected void onActivityResult(int requestCode, int resultCode, Intent data)" which is inside main activity will get the result. BUT... by using that way, it will close my sub activity and the system will go back to main activity...........
View 2 Replies
View Related
Sep 27, 2011
I am trying to send requests to a server in JSON format but my app die on the emulator when i try to send request. However the same code works fine as a normal java application.
Here is my code:
Code:
private HttpResponse doRequest(String url,JSONObject jso){
HttpClient client = new DefaultHttpClient();
HttpPost request = new HttpPost(url);
HttpResponse response = null;
[Code]...
What wrong with this code if it run perfectly in a java application?
View 3 Replies
View Related
May 26, 2010
I have just received my HTC desire, and setting up my email settings. I have three different email accounts, and set them all up. I set up the incoming server settings all fine, but when I put in the details for the outgoing server settings, and press NEXT button, I get the following each time: 'Cannot connect to the mail server to verify your account information. Your server is not responding.' This happens on all three accounts. I have used the same settings as on my computer which works when sending the emails on my computer. I finish the setting it up, but ofcourse I can receive emails, but can't send any.
View 10 Replies
View Related
Sep 28, 2010
I am working on my first Android Application. Now wat I want to do is to make a POST request to a restfull service running on server and I want the BODY of this request to be a JSon String. I am using GSon to generate the JSon to send to server. The code I am using to make the POST request follows:
HttpPost requisicao = new HttpPost();
requisicao.setURI(new URI(uri));
requisicao.setHeader("User-Agent", sUserAgent);
requisicao.setHeader("Content-type", "application/json");
HttpResponse resposta = null;.................
View 1 Replies
View Related
Mar 29, 2010
I am currently trying to send some data from and Android application to a php server (both are controlled by me). There is alot of data collected on a form in the app, this is written to the database. This all works.
In my main code, firstly I create a JSONObject (I have cut it down here for this example):
JSONObject j = new JSONObject();
j.put("engineer", "me");
j.put("date", "today");
j.put("fuel", "full");
j.put("car", "mine");
j.put("distance", "miles");
Next I pass the object over for sending, and receive the response:
String url = "http://www.server.com/thisfile.php";................
View 1 Replies
View Related
Jul 7, 2010
I'm trying to send a simple string (an access token I receive in the same program from another server) from my android emulator to my tomcat server running locally. Any ideas on where I should be looking?
View 2 Replies
View Related
Jan 16, 2010
I am developing an Android app that needs to communicate bi-directionally with a server. By that, I mean either the server or the device can send a message at any time, with an arbitrary amount of time in between messages. Sending data from the device to the server is a common and I think well understood task, but I'm not as sure what the best approach is to go in the opposite direction from the server to the device.
I think having the device periodically poll the server may be a bad idea due to latency and the drain on the battery, but I'd be willing to consider this option. My plan at the moment is to send text messages from the server via an email-to-SMS bridge, and to have my app run a service to receive and handle these messages.
The question I have is if there are any best practices for this scenario, and if using text messages has some downsides that I have failed to consider. For the sake of this question, I want to assume that users have an unlimited text data plan, so paying per text won't be an issue.
View 2 Replies
View Related
Nov 8, 2010
In android, how to send a file(data) from mobile to server using http.
View 2 Replies
View Related
Jun 11, 2009
I'm writing an Android App and I'm looking for the fastest (In terms of setup) way for me to send data to a server and receive information back on request. We're talking basic stuff. I have a log file which tells me how a user is using my application (In beta, I wouldn't runin a user experience by constantly logging usually) and I want to communicate that to my server (That I haven't setup).
I don't need security, I don't need high throughput or concurrent connections (I have 3 phones to play with) but I do need to set it up fast! I remember back in the day that setting up XAMPP was particularly brainless, then maybe I could use PHP to send the file from the phone to the Server? The Server would ideally be able to respond to a GET which would allow me to send back some SQL statements which ultimately affect the UI. (It's meant to adapt the presented options depending on those most commonly used).
So there you have it, I used PHP about 4 years ago and will go down that route if it's the best but if there's some kind of new fangled port open closing binary streaming singing and dancing method that has superseeded that option I would love to know. This tutorial seems useful but I don't really need object serialization, just text files back and forth, compressed naturally. Android comes with the Apache HTTP Client 4.0 built in as well as java.net.URL and java.net.HttpUrlConnection, I'd rather not add too much bult to my App with third party libraries.
View 5 Replies
View Related
Jun 29, 2010
I have the localized strings file that is used in the Iphone app that I work on to port to Android. Are there any tools that go through the file taken from the xcode project and build the xml needed to use the strings in android? This tool should be easy to build but I appreciate any pointers to already working tools.
View 4 Replies
View Related
Oct 1, 2010
In Android, capturing date from datepicker and storing as string in sqlite. Sorting by date doesn't work because they're strings (unless I'm doing it wrong.I've googled this issue for ~5 days, and it looks like there should be a way to capture the date from the date picker, convert it to a Long, store it in sqlite as a Long, select and sort on the Long date value, then convert the Long back to a "mm/dd/yyyy" string for display. I've tried various combinations of parse statements, Date, FormatDate, etc. with no luck at all.On activity start, get today's date and display it in button which calls the datepicker.Capture new date from datepicker (if one is entered), save it as a long to sqlite.On opening an activity showing a listview of records, select from sqlite with orderby on date (Long), convert Long to "mm/dd/yyyy" string for display in ListView.
View 3 Replies
View Related
May 5, 2009
If there's anyway way I to access the String values of String resources statically? e.g. a static equivalent of Context.getString(...)?
View 5 Replies
View Related
Jun 12, 2010
I know that this is not really an android question but i am new to both android and JSON. "Email":"g...@tkxel.com","Password":"123456"} to a url. The above structure is sent to Server in a variable named "json". The server reads the data and sends back the user information in a json object if the login is successful or {"error","-1"} if the authentication fails.................
View 2 Replies
View Related
May 5, 2010
I am running a Web service that allows users to record their trips (kind of like Google's MyTracks) as part of a larger app. The thing is that it is easy to pass data, including coords and other items, to the server when a user starts a trip or ends it. Being a newbie, I am not sure how to set up a background service that sends the location updates once every (pre-determined) period (min 3 minutes, max 1 hr) until the user flags the end of the trip, or until a preset amount of time elapses.
Once the trip is started from the phone, the server responds with a polling period for the phone to use as the interval between updates. This part works, in that I can display the response on the phone, and my server registers the user's action. Similarly, the trip is closed server-side upon the close trip request.........
View 2 Replies
View Related
Nov 24, 2010
Contact email *
Email address we should contact when you've been whitelisted:
aaa@gmail.com
Role account email *
Google Account ID that will be used for sending messages to C2DM:
bbb@gmail.com
I register from my app and sender id (bbb@gmail.com) to c2dm service and i get registration_id. After that my third party server must get ClientLogin authentication using email and password. From which email? The whitelisted email (aaa@gmail.com) or sender id (bbb@gmail.com)?? I try both email and from this process i got authorization_id. But when i use the registration_id and authorization_id to send message to C2DM Server, i got response codes 401 Unauthorize. I use authorization_id from whitelisted email (aaa@gmail.com) and sender id (bbb@gmail.com) but none worked.
View 2 Replies
View Related