I am very new to android .Can anyone please help me how to get mobile details of my android phone to servlet im using samsung galaxy.I should not use browser .I should get details from my android application please help me out thanks in advance
Asked
Active
Viewed 286 times
0
-
To get phone details: http://stackoverflow.com/questions/3596722/how-to-get-the-android-phone-model-version-sdk-details – Harry Joy Feb 28 '11 at 05:51
1 Answers
0
You can use the Build class to get information about the device and OS.
Update: See this code fragment;
// connect to the servlet
String location = "http://www.foo.com/servlet/TestServlet";
URL testServlet = new URL( servletLocation );
URLConnection servletConnection = testServlet.openConnection();
// inform the connection that we will send output and accept input
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
// Don't use a cached version of URL connection.
servletConnection.setUseCaches (false);
servletConnection.setDefaultUseCaches (false);
// Specify the content type that we will send binary data
servletConnection.setRequestProperty
("Content-Type", "<insert favorite mime type>");
// get input and output streams on servlet
. . .
// send your data to the servlet
. . .
See this article for details. Change it as per your needs.

Mudassir
- 13,031
- 8
- 59
- 87
-
thank you very much for ur reply i will be verythanks full if u give an example or sample program.. – rahul the great Feb 28 '11 at 05:55
-
@harry thank you very much i have checked your link.but how cani send those details to servlet please help me out – rahul the great Feb 28 '11 at 06:00
-
@Mudassir thank you very much i will go through it.should i use useragent at the mime type which u have specified?? – rahul the great Feb 28 '11 at 06:08
-
@rahul the great: Welcome Mr. Great. Feel free to ask in case of any query:) – Mudassir Feb 28 '11 at 06:10
-
should i use useragent at the mime type which u have specified?? thanks in advance – rahul the great Feb 28 '11 at 06:10
-
@rahul the great: Rahul, MIME type defines the type of data you want to transmit. I think you should use text/plain as you want to send only text data. – Mudassir Feb 28 '11 at 06:13
-
@Mudassir Thank you but how can i send the phone model ??where can i send it?? – rahul the great Feb 28 '11 at 06:15
-
@rahul the great: Your servlet should be aware of the parameters the client will send so that it can read them. Google about how to write servlets. Read the article carefully I've mentioned in the answer. – Mudassir Feb 28 '11 at 06:19
-
@mudassir..how can i send parameters from android to servlet using post methos thanks in advance... – rahul the great Feb 28 '11 at 06:41