Connection problem with Motorola

Go down

Connection problem with Motorola

Post  Exploring on Mon Sep 24, 2007 10:59 pm

i am trying to connect to server.But it is giving exception for motorola phones.I have tested it on MotoRazr v3i , L7i and L6i.
My questions is do we have to add something extra in connection code for moto phones.
As the application is working fine for all other phones.
Waiting for your reply.

hanks .....

Exploring

Posts : 2
Join date : 2007-09-24

View user profile

Back to top Go down

Re: Connection problem with Motorola

Post  Nishtha on Sun Sep 30, 2007 3:19 am

Exploring wrote:i am trying to connect to server.But it is giving exception for motorola phones.I have tested it on MotoRazr v3i , L7i and L6i.
My questions is do we have to add something extra in connection code for moto phones.
As the application is working fine for all other phones.
Waiting for your reply.

hanks .....

Hi,

When the application that use Http Connection works fine on some phones but not on other then there is problem in application setting. So recomend you to check the setting of internet APN on you mobile.

thanks
Nishtha.

Nishtha

Posts : 25
Join date : 2007-09-09

View user profile http://sahil-bedi.blogspot.com/

Back to top Go down

Re: Connection problem with Motorola

Post  guantana on Mon Oct 01, 2007 12:04 am

Hey hanks...

Motorola phones always being trouble in j2me...

Well, about your http conection i would recommend u to check all http header. I am attaching the sample code which works absolutely fine for me on motorola phones.

httpconnection = (HttpConnection) Connector.open(url,3,false);
if (postData == null) {
httpconnection.setRequestMethod(HttpConnection.GET);
} else {
httpconnection.setRequestMethod(HttpConnection.POST);
}

httpconnection
.setRequestProperty("User-Agent:", "Profile/"
+ Viewer.profile + " Configuration/"
+ Viewer.configuration);

httpconnection.setRequestProperty("Accept-Language:",
Viewer.acceptLanguage);
httpconnection.setRequestProperty("Connection", "close");

if (postData != null) {
httpconnection.setRequestProperty("Content-Length", String
.valueOf(postData.length()));

httpconnection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");

outputstream = httpconnection.openOutputStream();
writer = new OutputStreamWriter(outputstream, "UTF-8");

writer.write(postData);
postData = null;
}

is = httpconnection.openInputStream();

int resCode = httpconnection.getResponseCode();
avatar
guantana

Posts : 22
Join date : 2007-09-09
Location : New Delhi, India

View user profile http://guantana.blogspot.com

Back to top Go down

Re: Connection problem with Motorola

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum