brezen / jcoap

Automatically exported from code.google.com/p/jcoap
0 stars 0 forks source link

Android Port/ Documentation #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Looking for more documentation and any information on porting this to Android. 
Thanks!

Original issue reported on code.google.com by mjonesj...@gmail.com on 23 Jan 2013 at 12:34

GoogleCodeExporter commented 8 years ago
Not able to run BasicCoapClient on android. Coap Server is hosted on a laptop 
in the same wireless network. Need more documentation for the same.

Original comment by gogi.no...@gmail.com on 17 Apr 2014 at 4:01

GoogleCodeExporter commented 8 years ago
Please make documentation and issue portal for running jCoAP on android,
@goog1.no..@gmail.com::Did you find any solution to running the BasicCoapClient 
on android??

Original comment by NITIN.JA...@gmail.com on 19 Jun 2014 at 5:53

GoogleCodeExporter commented 8 years ago
Hi NITIN.JA...@gmail.com:: Yes I was able to run it on android. For my demo, I 
did the following steps:

- Inside onStart() method of my activity, I connected to the server using 
CoapChannelManager API. 

CoapChannelManager channelManager = BasicCoapChannelManager.getInstance();
clientChannel = channelManager.connect(....) ;

- Inside one of the listeners of a UI component, I created and sent the request 
over the channel acquired in onStart.

CoapRequest coapRequest = clientChannel.createRequest(true, 
CoapRequestCode.GET);
coapRequest.set.... // Multiple set statements
clientChannel.sendMessage(coapRequest);

- Add permission for INTERNET access in you android manifest. This is what I 
missed actually when I posted my last comment. After debugging, I found the 
issue :)

<uses-permission android:name="android.permission.INTERNET" /> 

Original comment by gogi.no...@gmail.com on 19 Jun 2014 at 6:04

GoogleCodeExporter commented 8 years ago
Thanks for taking time off to reply, but it does not seem to do the trick for 
me, did you tweak anything on the BasicCoapServer code?

Original comment by NITIN.JA...@gmail.com on 19 Jun 2014 at 6:37

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Nope.. no changes in server side code. Are you seeing any error in logcat ? Or 
any specific observations during debugging?

Original comment by gogi.no...@gmail.com on 19 Jun 2014 at 7:37

GoogleCodeExporter commented 8 years ago
No error in logcat...
Observations:
I found out that the the message to be sent is getting added to the sendBuffer 
in the BasicCoapSocketHandler but the sendBufferedMessages() method is not 
getting called...from the WorkerThread

Which version of android were you testing on by the way?

Original comment by NITIN.JA...@gmail.com on 19 Jun 2014 at 8:48

GoogleCodeExporter commented 8 years ago
I used API level 19 during design time. At runtime, my device is android 4.4. 
It worked even in 4.3.

Original comment by gogi.no...@gmail.com on 19 Jun 2014 at 8:52

GoogleCodeExporter commented 8 years ago
Ok...I think I should try it out on API 17 or above.Thank you.

Original comment by NITIN.JA...@gmail.com on 19 Jun 2014 at 9:21

GoogleCodeExporter commented 8 years ago
Yes....the minimum required API level for the library to work is API 17.Thank 
you.

Original comment by NITIN.JA...@gmail.com on 19 Jun 2014 at 10:22