cancel
Showing results for 
Search instead for 
Did you mean: 
Security Alert Log4j Security Vulnerability. Click here to know more.
cancel
Showing results for 
Search instead for 
Did you mean: 

Send Streaming data from Thingworx Foundation to Android Application

Srivaishnavi
4-Participant

Send Streaming data from Thingworx Foundation to Android Application

I am new to Thingworx. I have installed and run Thingworx Foundation Server 8.0. 

My requirement is to develop an Android application to receive some sample streaming data from Thingworx and display in my Android App without any sensors. 

I have referred these Guides 

1.  Android SDK Setup

2.  Thingworx android SDK Tutorial

I have downloaded the Thingworx-Android-SDK-1.1.2 and tried out some sample app called android-steam-thing and its working. In that example, I am connecting to a Thing SteamSensor1 which was available in the Thingworx-Android-SDK-1.1.2/samples/android-steam-thing/entity folder. In Android SDK,  we are setting Random numbers in Temperature, Pressure, TotalFlow, InletValve, etc, from Android to Thingworx using setProperty method

double temperature = 400 + 40 * Math.random();
double pressure = 18 + 5 * Math.random();
totalFlow += Math.random();
boolean inletValveStatus = true;

setProperty("Temperature", temperature);
setProperty("Pressure", pressure);
setProperty("TotalFlow", totalFlow);
setProperty("InletValve", inletValveStatus);

 

Now what I need is I need to send this random data from Thingworx Composer to my Thingworx Android App. 

And I can able to set a single value in a Thing property and get value in my App using getProperty() method.

But I need to send streaming data in a frequent interval from Composer to Android App. I don't have any sensors at present.  But I need some streaming data set up on my foundation server. What should I do in my composer? I have no idea,

IS THIS POSSIBLE? Any help is appreciated.

Attaching my Things_SteamSensor1.xml 

 

1 REPLY 1

I'm not really sure what you meant with you need to setup streaming data, however as you mentioned that you can get the random values to generate and you have a value stream created. You now could 

 

1. Use all the properties from the Thing in the Composer and enable Logging for those properties

2. Assign the value stream to the Thing which has all properties whose value you want to record and send to the Android APP

3. Create a subscription using the event either on a particular property or just use AnyDataChange event in which case data change on any property will fire the event which in turn will invoke the subscription.

4. In this subscription you can provide your code which will send the update to the android app from ThingWorx

 

Another scenario, if you are just looking to send these property values to the android app regardless if there is any property update on that thing or not, you can use the Timer / Scheduler Thing and configure it to fire an event like for e.g. every 1min and then using the subscription like mentioned above.

 

Does this help? Let me know if you have further questions to this.

Announcements