Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » How to retrieve MqttService Binder
How to retrieve MqttService Binder [message #1700075] Tue, 30 June 2015 01:39 Go to next message
Jolene Carter is currently offline Jolene CarterFriend
Messages: 1
Registered: June 2015
Junior Member
Hi guys!

I'm currently trying out
MqttService 
and
MqttServiceBinder
from v1.0.2 of org.eclipse.paho.android.service. However, I am having trouble trying to retrieve the
MqttService
after binding my activity to the service.

I've tried to retrieve the service by first binding the service to the activity with
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);


And later obtaining the service from the binder in
onServiceConnected(ComponentName className, IBinder service)
method in the
ServiceConnection
class. There's a public
getService
provided by
MqttServiceBinder
. However, the access level of the
MqttServiceBinder
class is now default, meaning that I cannot access it outside of its package, and thus am unable to cast the
IBinder 
to
MqttServiceBinder 
in my activity class.

I'm quite new to Android, so it will be great if anyone can explain to me how to obtain the
MqttService 
to set the various attributes such as the client id for the
MqttConnection
.
Re: How to retrieve MqttService Binder [message #1705134 is a reply to message #1700075] Wed, 12 August 2015 10:57 Go to previous message
James Sutton is currently offline James SuttonFriend
Messages: 69
Registered: July 2015
Member
Hi,

It sounds like you actually want the MqttAndroidClient.
Take a look at ClientConnections.java and AndroidManifest.xml from the sample app (http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/tree/org.eclipse.paho.android.service/org.eclipse.paho.android.service.sample).
The sample app should be a good starting point as it covers all of the basic MQTT service functionality.
Previous Topic:Having trouble getting connection to iot.eclipse.org (javascript)
Next Topic:Paho MQQTT Client get an java.util.concurrent.TimeoutException
Goto Forum:
  


Current Time: Tue Sep 25 22:31:35 GMT 2018

Powered by FUDForum. Page generated in 0.01546 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top