Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7781267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:10:21+00:00 2026-06-01T19:10:21+00:00

I’m having some problems using the fusesource mqtt-client-java1.4-uber-1.0 (in an android app). when I

  • 0

I’m having some problems using the fusesource mqtt-client-java1.4-uber-1.0 (in an android app). when I provide a wrong IP or the mqtt broker is not running on the proper IP it alerts the message “Could not connect (callback)” but not “Could not connect (listener)”. When i provide the proper ip and the broker is running no alerts appear at all. I Guess the listeners do not work at all and somehow the success callback of the connection doesn’t eighter. any idears? Below the full code of the android activity.

I’m using this version of the mqtt-client: mqtt-client-java1.4-uber-1.0.jar
I also tried different messe brokers (servers) which are RSMB and Mosquitto

package racenet.mqtt;

import java.net.URISyntaxException;

import org.fusesource.hawtbuf.Buffer;
import org.fusesource.hawtbuf.UTF8Buffer;
import org.fusesource.mqtt.client.Callback;
import org.fusesource.mqtt.client.CallbackConnection;
import org.fusesource.mqtt.client.Listener;
import org.fusesource.mqtt.client.MQTT;

import racenet.mqtt.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;

public class MQTTActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        MQTT mqtt = new MQTT();

        try {

            mqtt.setHost("tcp://proper-ip-here:1883");

        } catch (URISyntaxException e) {

            new AlertDialog.Builder(MQTTActivity.this)
                .setMessage("Could not set host")
                .setNeutralButton("OK", null)
                .show();
        }

        final CallbackConnection connection = mqtt.callbackConnection();
        connection.listener(new Listener() {

            public void onConnected() {

                new AlertDialog.Builder(MQTTActivity.this)
                    .setMessage("Connected (listener)")
                    .setNeutralButton("OK", null)
                    .show();
            }

            public void onDisconnected() {

                new AlertDialog.Builder(MQTTActivity.this)
                    .setMessage("Disconnected (listener)")
                    .setNeutralButton("OK", null)
                    .show();
            }

            public void onFailure(Throwable arg0) {

                new AlertDialog.Builder(MQTTActivity.this)
                    .setMessage("Failure (listener)")
                    .setNeutralButton("OK", null)
                    .show();
            }

            public void onPublish(UTF8Buffer arg0, Buffer arg1, Runnable arg2) {

                new AlertDialog.Builder(MQTTActivity.this)
                    .setMessage("Publish (listener)")
                    .setNeutralButton("OK", null)
                    .show();
            }
        });

        connection.connect(new Callback<Void>() {

            public void onFailure(Throwable value) {

                new AlertDialog.Builder(MQTTActivity.this)
                    .setMessage("Could not connect (callback)")
                    .setNeutralButton("OK", null)
                    .show();
            }

            public void onSuccess(Void v) {

                new AlertDialog.Builder(MQTTActivity.this)
                    .setMessage("Connected (callback)")
                    .setNeutralButton("OK", null)
                    .show();
            }
        });
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:10:24+00:00Added an answer on June 1, 2026 at 7:10 pm

    mqtt-client-java1.4-uber-1.0 simply is a crappy implementation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.