# XBee API Mode - IDataReceiveListener query

**URL:** <https://forums.digi.com/t/xbee-api-mode-idatareceivelistener-query/16580>\
**Category:** XBee & XBee Gateway\
**Tags:** java, mode, xbee-api, beaglebone, \-\
**Created:** [April 12, 2016, 8:00am UTC](https://forums.digi.com/t/xbee-api-mode-idatareceivelistener-query/16580 "2016-04-12T08:00:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaydriver](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@jaydriver](https://forums.digi.com/u/jaydriver)\
**Post date:** [April 12, 2016, 8:00am UTC](https://forums.digi.com/t/xbee-api-mode-idatareceivelistener-query/16580/1 "2016-04-12T08:00:42Z")

</div>

Hi,

I’m fairly new to Zigbee and familiar enough with Java.

I have been playing around with a coordinator(connected to windows machine) and a router(connected to a beaglebone) and can send data between the two Zigbee devices independantly ie. send from coord-router and vice versa using seperate code.

However I want to implement a setup where the coord will send a message to the router, the router will receive this and reply back to the coord with a response.

I’m using the sample code in the API Docs (MainApp & MyDataReceiveListener) to do this however I cannot send data with the myDevice.sendData() method within MyDataReceiveListener as myDevice is declared int he MainApp(). Does anyone have any ideas how to go about this?

I know this is very basic in what I’m trying to do so apologies!

Thanks.

---

<div class="post-metadata">

**Author:** ![jaydriver](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@jaydriver](https://forums.digi.com/u/jaydriver)\
**Post date:** [April 22, 2016, 8:15am UTC](https://forums.digi.com/t/xbee-api-mode-idatareceivelistener-query/16580/2 "2016-04-22T08:15:21Z")

</div>

Issue resolved.

I had jumped the gun, rather than use the listener I should of used the polling example.

Application now running as expected.
