[android-developers] question on reading from socket in android ...

2010-01-18 Thread Antonio Si
Hi,

I have a background thread in my android client which sends a request
to a server using a
socket and then tries to read the data back from the socket.

The data sending part works fine, but when I try to read from the
inputStream of the socket,
I am getting a EOFException.

Any suggestions or advice would be highly appreciated.

Thanks very much.

Antonio.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: question on reading from socket in android ...

2010-01-18 Thread Antonio Si
Hi Marc,

Thanks for your prompt response. Here is the code that I have:

  InetAddress addr = InetAddress.getByAddress(hostIp);
  socket = new Socket(addr, portNumber);
  socket.setKeepAlive(true);

  DataInputStream dis = new DataInputStream(new BufferedInputStream
(socket.getInputStream()));
  DataOutputStream dos = new DataOutputStream(new
BufferedOutputStream(socket.getOutputStream()));

  byte[] intBytes = convertToBytes(data.length);
  byte[] strMsgLengthBytes = convertToBytes(strMsgSize);
  dos.write(intBytes, 0, intBytes.length);
  dos.write(strMsgLengthBytes, 0, strMsgLengthBytes.length);
  dos.write(data, 0, data.length);
  dos.flush();

  ObjectInputStream ois = new ObjectInputStream(dis); // Here is
the place where an EOFException is being thrown
  ListResponseDataString returnObject =
(ListResponseDataString) ois.readObject();

In the above code, the line ois = new ObjectInputStream(dis); is the
place where an EOFException is being thrown.
In my server, I have checked that it has received the data
successfully. By the time the server tries to write to the
socket, the server is getting the following exception when it tries to
get an OutputStream from the socket:

java.net.SocketException: Socket is closed
at java.net.Socket.getOutputStream(Socket.java:814)

I would appreciate any advice.

Regards,

Antonio.


On Jan 18, 3:15 am, Marc Reichelt mcreich...@googlemail.com wrote:
 Hi Antonio,

 it would be much easier if you would provide a small piece of example
 code. Otherwise we can only guess what your problem is.

 Regards

 Marc Reichelt   ||  http://www.marcreichelt.de/

 On 18 Jan., 09:16, Antonio Si antonio...@gmail.com wrote: Hi,

  I have a background thread in my android client which sends a request
  to a server using a
  socket and then tries to read the data back from the socket.

  The data sending part works fine, but when I try to read from the
  inputStream of the socket,
  I am getting a EOFException.

  Any suggestions or advice would be highly appreciated.

  Thanks very much.

  Antonio.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] adb cannot find my dev phone

2009-11-14 Thread Antonio Si
Hi,

I just got my android dev phone, but when I invoke adb devices, it only shows:

List of devices attached
no permissions

What does it mean? What is the problem and how should I fix it?

Would appreciate any input.

Thanks.

Antonio.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] how to update the dev phone to 2.0?

2009-11-13 Thread Antonio Si
Hi,

Is Android 2.0 supported on the dev phone? I do not see any image
packages available for 2.0 in http://developer.htc.com/adp.html ?

Thanks very much.

Antonio.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] question on WAP Push support on Android

2009-11-12 Thread Antonio Si
Hi,

I have search through the group and does not seem to find a solution
to this problem.

I have setup a WAP Push gateway. How can I setup my Android phone to connect
to the gateway? Or does WAP Push support in Android? Or what would be a best
way to send data from a server to a Android device?

Any pointers will be highly appreciated.

Thanks in advance.

Antonio.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: intercept SMS inbound message

2009-11-12 Thread Antonio Si
I am having a similar problem and would appreciate any pointers in
this problem.

Thanks.

Antonio.

On Nov 11, 4:44 pm, Sean Liao wirelessw...@gmail.com wrote:
 Hi,
 I got a sample code how to intercept SMS inbound message.  It is
 really simple, and I really admire android make it so easy:

 // declare the intercepter

         receiver android:name=.SmsReceiver
             intent-filter
                 action android:name=
                     android.provider.Telephony.SMS_RECEIVED /
             /intent-filter
         /receiver

 public class SmsReceiver extends BroadcastReceiver
 {
         @Override
         public void onReceive(Context context, Intent intent)
        {        
         }

 }

 However, there is a problem.  The message also shows in the system
 inbox.  Is there a way really to intercept it (not let the system
 receive it)?  Or is there any API I can remove it from system inbox as
 soon as I read it from my program?

 Thanks in advance.
 Sean

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] question on Android dev phone

2009-10-26 Thread Antonio Si

Hi,

I am new to Android development, so perhaps this is a stupid question.
I understand the Android dev phone cannot download apps from the
Marketplace if the app is copy protected? Is there any way around this
limitation?

But I suppose other Google apps like the barcode scanner (http://
googlemobile.blogspot.com/2009/05/google-product-search-for-android-
now.html) should work, right?

Antonio.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---