cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Android App Issue when connecting to TW Server

pdahmen
1-Visitor

Android App Issue when connecting to TW Server

Hi,

I'm trying to create an Android App using the Java SDK and i am encountering a connection issue when starting up the app.

09-29 14:15:32.896  12257-12275/com.ptc.ptcnet.sensoren I/System.out﹕ 14:15:32.895 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - CommunicationEndpoint Monitor - checking for disconnected endpoints

09-29 14:15:32.896  12257-12275/com.ptc.ptcnet.sensoren I/System.out﹕ 14:15:32.896 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint not connected [name: SeamSensorGateway, id: 0]. Attempting [re]connect...

09-29 14:15:32.896  12257-12275/com.ptc.ptcnet.sensoren I/System.out﹕ 14:15:32.896 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 0]

09-29 14:15:32.897  12257-12275/com.ptc.ptcnet.sensoren I/System.out﹕ 14:15:32.897 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.ClientCommunicationEndpoint - Needed to refill connections on client endpoint [id: 0] : [active: 0, max: 1]

09-29 14:15:32.897  12257-12275/com.ptc.ptcnet.sensoren I/System.out﹕ 14:15:32.897 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: ws://10.199.66.97:8080/Thingworx/WS] failed : Attempt to invoke interface method 'io.netty.channel.Channel io.netty.channel.ChannelFuture.channel()' on a null object reference

09-29 14:15:32.898  12257-12275/com.ptc.ptcnet.sensoren I/System.out﹕ 14:15:32.898 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint reconnection was unsuccessful [name: SeamSensorGateway, id: 0]

Can anybody help me with this?

Kind regards Philip

7 REPLIES 7
ckulak
12-Amethyst
(To:pdahmen)

Hello Philip,

I don't think EDGE SDK for Java is supported on Android: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS214242&source=Case%20Viewer

In case you don't have access to PTC Tech Support web site -- basically it says "Android SDK is in development and will be available in near future"

As is it may work under some circumstances, but I'm afraid nobody will give you any guaranties. Check Bertrand's answer on this topic or consider using RESTful web services instead.

/ Constantine

pdahmen
1-Visitor
(To:ckulak)

Thanks for the quick answer.

I now added the internet permission like Bertrand said and now my emulator connects but it doesnt show up in ThingWorx under Remote Things like it should.

the log shows the following lines

09-30 08:49:53.914  21089-21125/com.ptc.ptcnet.sensoren I/System.out﹕ 08:49:53.914 [NettyClient-NIO-1] DEBUG c.t.c.c.e.DispatchingClientEndpoint - RESPONSE received [endpoint id: 0, duration: 5] ResponseMessage [requestId: 5, endpointId: 0, sessionId: -1, code: STATUS_SUCCESS, multipart: false, packet #: 0, total packets: 0]

09-30 08:49:53.915  21089-21136/com.ptc.ptcnet.sensoren I/System.out﹕ 08:49:53.915 [ClientProcessor-2] DEBUG c.t.c.c.e.CommunicationEndpoint - Sending synchronous message, waiting for response [sync key: 6, message: APIRequestMessage [requestId: 6, endpointId: 0, sessionId: 14, method: POST, entityName: SeamSensorGateway, characteristic: Services, target: GetEventSubscriptions]]

09-30 08:49:53.915  21089-21125/com.ptc.ptcnet.sensoren I/System.out﹕ 08:49:53.915 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=59

09-30 08:49:53.919  21089-21125/com.ptc.ptcnet.sensoren I/System.out﹕ 08:49:53.919 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=2

09-30 08:49:53.919  21089-21125/com.ptc.ptcnet.sensoren I/System.out﹕ 08:49:53.919 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=63

09-30 08:49:53.920  21089-21125/com.ptc.ptcnet.sensoren I/System.out﹕ 08:49:53.919 [NettyClient-NIO-1] DEBUG c.t.c.c.e.DispatchingClientEndpoint - RESPONSE received [endpoint id: 0, duration: 4] ResponseMessage [requestId: 6, endpointId: 0, sessionId: -1, code: STATUS_SUCCESS, multipart: false, packet #: 0, total packets: 0]

09-30 08:49:53.921  21089-21125/com.ptc.ptcnet.sensoren I/System.out﹕ 08:49:53.921 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=17

When i run the app on my own phone it says there is a protocol version error.

Is it related to using the Java SDK and the Android one?

Any ideas?

billrei
12-Amethyst
(To:pdahmen)

The Java SDK will not work directly inside an Android application because it is based on Netty which requires the Java New IO package (nio) which is not provided as part of the Android VM.

I am working on the ThingWorx Android SDK right now. It is planned for release next month and will deliver the same capabilities as the Java SDK.


pdahmen
1-Visitor
(To:billrei)

Hi Bill,

is there any way i can get into Beta testing or is it just not possible?Would really appreciate it

victorp
7-Bedrock
(To:pdahmen)

Hi Philip and Constantine,

The Android SDK is in active development.  We are planning a production release in December, but are now providing an Alpha version of the SDK. 

Those interested to use the Android SDK v.Alpha, please click on my username and send me a direct message including your email address. 


Thank you!

Victor Piper

Product Manager, ThingWorx

billrei
12-Amethyst
(To:pdahmen)

The Android SDK is in Beta now. See here Android SDK Beta - Updated 12-23-15

ckulak
12-Amethyst
(To:billrei)

Nice Christmas present, thank you Bill

Announcements


Top Tags