connecting to gmail using j2me

Java programming topics
Post Reply
ni30rocks
Corporal
Corporal
Posts: 3
Joined: Fri Sep 24, 2010 12:17 pm

connecting to gmail using j2me

Post by ni30rocks » Fri Sep 24, 2010 2:30 pm

I have tried to connect to gmail using IMAP and specification given on http://mail.google.com/support/bin/a...n&answer=78799.

My code looks like

Code: Select all

StreamConnection socket;
byte serverData[]= new byte[50];
byte accountInfo[],emailAddInfo[]=new byte[500];
try
{
socket = (StreamConnection)Connector.open("socket://imap.gmail.com:993");

DataOutputStream oStrm = socket.openDataOutputStream();
oStrm.writeChars("Account Name:username@your_domain.com");//my account name
oStrm.writeChars("Email Address:username@your_domain.com");//my email address

InputStream iStrm = socket.openInputStream();
iStrm.read(serverData);
String str= new String(serverData);
System.out.println(str);
list.append(str, null);
for (int i = 0; i < serverData.length; i++)
{
System.out.println(serverData[i]);
}
iStrm.close();

} catch Exception
But response from gmail server is empty... Server data is printing streams of 0's...

help me finding out the issue...
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: connecting to gmail using j2me

Post by Neo » Fri Sep 24, 2010 3:25 pm

If the link you mentioned is http://mail.google.com/support/bin/answ ... swer=78799, it just contains the port configuration for mail clients, isn't it?
ni30rocks
Corporal
Corporal
Posts: 3
Joined: Fri Sep 24, 2010 12:17 pm

Re: connecting to gmail using j2me

Post by ni30rocks » Fri Sep 24, 2010 3:27 pm

yes sir...
It is the same link I mentioned..
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: connecting to gmail using j2me

Post by Neo » Fri Sep 24, 2010 5:33 pm

Did you try Mail4Me?

Mail4Me wiki reference:
http://wiki.forum.nokia.com/index.php/S ... plications

Mail4me API ref:
http://mail4me.objectweb.org/software/d ... index.html

Mail4Me source code / jar - jad / sample app:
http://mail4me.objectweb.org/software/downloads/

See IMAP with SSL (needed for Gmail)
http://mail4me.objectweb.org/software/d ... .String%29

However I have seen that you made it as in Nokia forum :) (http://discussion.forum.nokia.com/forum ... using-j2me)

If you like to share a tutorial, ROBOT.LK is the place for you to do so.
Post Reply

Return to “Java Programming”