Giter Site home page Giter Site logo

paho.mqtt.android's Introduction

Eclipse Paho Android Service

Build Status

The Paho Android Service is an MQTT client library written in Java for developing applications on Android.

Features

MQTT 3.1 ✔️ Automatic Reconnect ✔️
MQTT 3.1.1 ✔️ Offline Buffering ✔️
LWT ✔️ WebSocket Support ✔️
SSL / TLS ✔️ Standard TCP Support ✔️
Message Persistence ✔️

To get started, download Android Studio. You will also need to download the Android SDK. Currently you will need the SDK for 24.

Project description:

The Paho project has been created to provide reliable open-source implementations of open and standard messaging protocols aimed at new, existing, and emerging applications for Machine-to-Machine (M2M) and Internet of Things (IoT). Paho reflects the inherent physical and cost constraints of device connectivity. Its objectives include effective levels of decoupling between devices and applications, designed to keep markets open and encourage the rapid growth of scalable Web and Enterprise middleware and applications.

Links

Using the Paho Android Client

Downloading

Maven

Eclipse hosts a Nexus repository for those who want to use Maven to manage their dependencies.

Add the repository definition and the dependency definition shown below to your pom.xml.

Replace %REPOURL% with either https://repo.eclipse.org/content/repositories/paho-releases/ for the official releases, or https://repo.eclipse.org/content/repositories/paho-snapshots/ for the nightly snapshots. Replace %VERSION% with the level required . The latest release version is 1.1.1 and the current snapshot version is 1.1.2-SNAPSHOT.

<project ...>
<repositories>
    <repository>
        <id>Eclipse Paho Repo</id>
        <url>%REPOURL%</url>
    </repository>
</repositories>
...
<dependencies>
    <dependency>
        <groupId>org.eclipse.paho</groupId>
        <artifactId>org.eclipse.paho.android.service</artifactId>
        <version>%VERSION%</version>
    </dependency>
</dependencies>
</project>

Gradle

If you are using Android Studio and / or Gradle to manage your application dependencies and build then you can use the same repository to get the Paho Android Service. Add the Eclipse Maven repository to your build.gradle file and then add the Paho dependency to the dependencies section.

repositories {
    maven {
        url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
    }
}


dependencies {
    compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
    compile 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
}

Note: currently you have to include the org.eclipse.paho:org.eclipse.paho.client.mqttv3 dependency as well. We are attempting to get the build to produce an Android AAR file that contains both the Android service as well as it's dependencies, however this is still experimental. If you wish to try it, remove the org.eclipse.paho:org.eclipse.paho.client.mqttv3 dependency and append @aar to the end of the Android Service dependency. E.g. org.eclipse.paho:org.eclipse.paho.android.service:1.1.1@aar

If you find that there is functionality missing or bugs in the release version, you may want to try using the snapshot version to see if this helps before raising a feature request or an issue.

Building from source

  • Open a terminal and navigate to this directory (org.eclipse.paho.android.service)
  • Run the command ``./gradlew clean assemble exportJaror on Windows:gradlew.bat clean assemble exportJar`

Running the Sample App:

  • Open the this current directory in Android Studio (org.eclipse.paho.android.service).
  • In the toolbar along the top, there should be a dropdown menu. Make sure that it contains 'org.eclipse.android.sample' then click the Green 'Run' Triangle. It should now build and launch an Virtual Android Device to run the App. If you have an Android device with developer mode turned on plugged in, you will have the oppertunity to run it directly on that.
  • If you have any problems, check out the Android Developer Documentation for help: https://developer.android.com

paho.mqtt.android's People

Contributors

blundell avatar hannesa2 avatar icraggs avatar jpwsutton avatar mcarrer avatar miketran78727 avatar nisrulz avatar peterjeschke avatar powturns avatar zyyangbj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paho.mqtt.android's Issues

Char escape in DatabaseMessageStore

migrated from Bugzilla #467378
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version 1.2 on platform Other
Assigned to: James Sutton

On 2015-05-15 04:04:16 -0400, Manuel Dominguez wrote:

Hi,

I'm letting my users (Android mobile users) to create usernames that contains also chars like ',*,=.... These chars are compatible with JSON specification (no need to escape) and are correctly treated in the backend once the JSON message containing these chars arrives. However, the mobile app throws an exception when the username includes "'", because the DatabaseMessageStore is not escaping this char. For instance, if I connect using "myuser'-3850856779" this happens:

android.database.sqlite.SQLiteException: near ":sc": syntax error (code 1): , while compiling: DELETE FROM MqttArrivedMessageTable WHERE clientHandle='ssl://ec2-XXXXXXXXXXXX.us-west-2.compute.amazonaws.com:443:myuser'-3850856779:sc.enzinatec.com.sc_android'
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
        at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
        at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
        at android.database.sqlite.SQLiteDatabase.delete(SQLiteDatabase.java:1496)
        at org.eclipse.paho.android.service.DatabaseMessageStore.clearArrivedMessages(DatabaseMessageStore.java:365)
        at org.eclipse.paho.android.service.MqttConnection.connect(MqttConnection.java:195)
        at org.eclipse.paho.android.service.MqttService.connect(MqttService.java:323)
        at org.eclipse.paho.android.service.MqttAndroidClient.doConnect(MqttAndroidClient.java:462)
        at org.eclipse.paho.android.service.MqttAndroidClient.access$200(MqttAndroidClient.java:70)
        at org.eclipse.paho.android.service.MqttAndroidClient$MyServiceConnection.onServiceConnected(MqttAndroidClient.java:109)
        at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1203)
        at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1220)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5221)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Regards.

On 2015-05-15 04:11:15 -0400, Manuel Dominguez wrote:

I think this line (375 of DatabaseMessageStore) is the problem:

rows = db.delete(ARRIVED_MESSAGE_TABLE_NAME,MqttServiceConstants.CLIENT_HANDLE + "='" + clientHandle + "'", null);

Mmmm. SQL injection?

On 2015-07-16 02:41:25 -0400, bob Wen wrote:

change the code to:

db.delete(ARRIVED_MESSAGE_TABLE_NAME,
MqttServiceConstants.MESSAGE_ID + " = ? AND " + MqttServiceConstants.CLIENT_HANDLE + " = ?",
new String[]{ id, clientHandle });

and it seems work fine.

On 2015-08-17 06:30:06 -0400, Ian Craggs wrote:

Assigning to James

On 2015-09-01 08:33:09 -0400, James Sutton wrote:

This is a textbook SQL injection vulnerability. I'll go through and update all the queries to prevent this.

On 2015-09-01 10:25:53 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/55006

On 2015-09-04 04:33:36 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/55006 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 7b4749a

On 2015-09-04 04:39:11 -0400, James Sutton wrote:

This has been merged into the develop branch. Setting to resolved.

On 2015-09-04 06:03:03 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/55274

On 2015-09-04 06:34:17 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/55274 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 712b61a

Can not receive any message while ping(call checkForActivity() method) return a null MqttToken

migrated from Bugzilla #472149
status CLOSED severity critical in component MQTT-Android for 1.2
Reported in version 1.0 on platform PC
Assigned to: Ian Craggs

Original attachment names and IDs:

On 2015-07-08 05:09:31 -0400, liqiang zhou wrote:

Created attachment 255054
while onReceice() method in AlarmPingSender class get null.

I use mqtt-java-client project and mqtt-android-service project in my project,I set keepAliveInterval is 120 seconds, when just connected to server, My project receive message good.When ping time reached, may call checkForActivity() method in ClientState class, but in my project this method may return null or a MqttToken object, if return null, my project can not receive any message form server, just like blocked, if return a good MqttToken object, my project also miss many message from server. I think it is a bug in mqtt-java-client.Thank you!

On 2015-07-09 06:48:33 -0400, liqiang zhou wrote:

Sorry about this, my server release a different ping from paho client, so...

Improve SSL/TLS Certificate flow for Android Service

migrated from Bugzilla #483183
status UNCONFIRMED severity normal in component MQTT-Android for 1.2
Reported in version future on platform All
Assigned to: James Sutton

On 2015-11-27 09:57:15 -0500, James Sutton wrote:

Currently the Android Service has a helper method in MqttAndroidClient called getSSLSocketFactory that takes an InputStream and password for a BouncyCastle Keystore containing a X509 certificate for the MQTT broker.

This is very inconvenient for the developer and has a number of restrictions:

  • The Developer has to manually create or locate a BKS Keystore containing the X509 certificate.
  • The helper method only allows for an X509 cert to be added. This means that it is not possible to set up a client private key.
  • The Developer could build their own SSLSocketFactory that adds an X509, .p12 or both certificates, but it is likely that most developers would end up with similar code to accomplish this across most use cases.

The Owntracks Android app has a good helper class SocketFactory (https://github.com/owntracks/android/blob/master/src/main/java/org/owntracks/android/support/SocketFactory.java) that allows the user to provide the raw certificates and returns a Socket Factory that uses them.

I've contacted Alexander (https://github.com/binarybucks) who authored this class and asked if he would like to contribute it to the Android Service, he's happy to do this and confirmed that as Owntracks is also under EPL it shouldn't be a problem.

Once this class has been contributed, we can create a new helper method in MqttAndroidClient that allows the developer to directly provide certificates.

[feature] Auto connect after connect fail

migrated from Bugzilla #443363
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform Other
Assigned to: Tang Zi Han

On 2014-09-05 01:08:51 -0400, Zhang Yang wrote:

Auto connect after connect fail

On 2014-09-12 03:55:38 -0400, Tang Zi Han wrote:

Implemented in develop branch.

On 2014-09-12 05:37:31 -0400, Ian Craggs wrote:

Please describe the design of the solution you have implemented and how it helps the application users and developers.

On 2014-09-18 17:19:23 -0400, Tang Zi Han wrote:

  1. No API changes.

  2. When connection fails and the network is available ,call the connect action again in connection failure callback(MqttConnection.java).
    @OverRide
    public void onFailure(IMqttToken asyncActionToken,Throwable exception) {
    resultBundle.putString(
    MqttServiceConstants.CALLBACK_ERROR_MESSAGE,
    exception.getLocalizedMessage());
    resultBundle.putSerializable(
    MqttServiceConstants.CALLBACK_EXCEPTION, exception);
    Log.i(TAG, "connect fail, call connect to reconnect.reason:"+exception.getMessage());
    service.traceError(TAG,
    "connect fail, call connect to reconnect.reason:"
    + exception.getMessage());

              doAfterConnectFail(resultBundle);
    
              // if connect fail ,try reconnect.
              if(service.isOnline()){
                  connect(connectOptions, internel_invocationContext,connectActivityToken);
              }
    
          }
    
  3. The reconnect strategy will be the same with 'reconnect strategy in connect failure [https://bugs.eclipse.org/bugs/show_bug.cgi?id=443375], and will be added to this feature.

On 2014-09-18 17:24:21 -0400, Tang Zi Han wrote:

The logic in connection failure callback (MqttConnection.java)
@OverRide
public void onFailure(IMqttToken asyncActionToken,Throwable exception) {
resultBundle.putString(MqttServiceConstants.CALLBACK_ERROR_MESSAGE,
exception.getLocalizedMessage());
resultBundle.putSerializable(MqttServiceConstants.CALLBACK_EXCEPTION, exception);
service.traceError(TAG,"connect fail, call connect to reconnect.reason:"

  • exception.getMessage());

    doAfterConnectFail(resultBundle);
    // if connect fail ,try reconnect.
    if(service.isOnline()){
    connect(connectOptions,internel_invocationContext,
    connectActivityToken);
    }

}
private void doAfterConnectFail(final Bundle resultBundle){

acquireWakeLock();
disconnected = true;
setConnectingState(false);
service.callbackToActivity(clientHandle, Status.ERROR,resultBundle);
releaseWakeLock();
}

On 2014-09-19 11:16:56 -0400, Ian Craggs wrote:

Hi Amy,

we need to know what the intended behaviour is here, not what the code looks like. We didn't intend you to copy the code here. Code shows how it has been implemented, not necessarily how the solution was intended to work (there may be bugs).

Can you describe the intended behaviour please? Thanks

Mqtt android sample did not support SSL key importing

migrated from Bugzilla #447244
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform Other
Assigned to: Rong Xiang

On 2014-10-15 04:41:41 -0400, Zhang Yang wrote:

In MQTT android sample, there is selection of whether use SSL for security, but does not provide any way to import SSL key file.

On 2015-01-19 22:21:44 -0500, Rong Xiang wrote:

Finished the implementation of adding a selector for user to choice the key file.

Security issue: Paho Android Service is broadcasting all messages and events system wide

migrated from Bugzilla #446379
status RESOLVED severity blocker in component MQTT-Android for 1.1
Reported in version 1.0 on platform All
Assigned to: Tang Zi Han

Original attachment names and IDs:

On 2014-10-08 17:48:26 -0400, Giso Bartels wrote:

Created attachment 247735
Use LocalBroadcastManager instead of system wide one

The MqttService is using broadcasts to deliver events and messages to the MqttAndroidClient. Those broadcasts are advertised system wide and any third party app also registering a BroadcastReceiver with an action string as in MqttServiceConstants.CALLBACK_TO_ACTIVITY will receive those messages.

As a quick fix, broadcasting should only be handled by the LocalBroadcastManager from Android's support library.

Bonus issue: If a user has two or more apps using Paho Android Service installed, those apps will deliver events/messages to each other leading to undefined behavior and possibly crashes.

Attached patch is based on commit SHA: 8de5d20

On 2014-12-05 01:49:23 -0500, Tang Zi Han wrote:

Fixed at https://git.eclipse.org/r/#/c/37627/

Replace the system wide broadcast with the android.support.v4.content.LocalBroadcastManager;

connectionLost(...) not triggered after a connection timeout expiration.

migrated from Bugzilla #474087
status UNCONFIRMED severity major in component MQTT-Android for 1.2
Reported in version 1.2 on platform PC
Assigned to: James Sutton

Original attachment names and IDs:

On 2015-08-01 06:29:36 -0400, Manuel Dominguez wrote:

After a timeout, the android service goes down. These are the messages:

07-31 13:56:53.540 2026-2026/com.enzinatec.sexcheer E/ClientState� manolodd-1403284640: Timed out as no activity, keepAlive=180,000 lastOutboundActivity=1,438,343,613,756 lastInboundActivity=1,438,343,430,399 time=1,438,343,813,539 lastPing=1,438,343,613,756
07-31 13:56:53.541 2026-2026/com.enzinatec.sexcheer D/AlarmPingSender� Failure. Release lock(MqttService.client.manolodd-1403284640):1438343813541

07-31 13:56:53.542 2026-2026/com.enzinatec.sexcheer D/AlarmPingSender� Unregister alarmreceiver to MqttServicemanolodd-1403284640

I can see this logic in http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/tree/org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service/AlarmPingSender.java

However, although a disconnection has been detected due to a timeout expiration, the connectionLost(...) callback is not triggered. Hence, It is not possible to detect the moment when the MQTT has been lost to send a notification to the user and/or start a reconnect logic. connectionLost(...) is correctly triggered when the connection is closed, but seems to do nothing when the connection timeout expires.

Is there any asynchronous way of detecting a timeout expiration?

Regards.

On 2015-08-17 06:27:31 -0400, Ian Craggs wrote:

Assigning to James

On 2015-09-02 05:22:23 -0400, James Sutton wrote:

Created attachment 256310
Timeout StackTrace

On 2015-09-02 05:26:03 -0400, James Sutton wrote:

I've managed to recreate a time-out using the Sample Application and added some logging to show when the ConnectionLost callback was being called. As you can see in the attachment, when the connection timed out the callback was called: D/MqttCallbackHandler� Connection Lost!

Have you implemented the MqttCallback correctly? Or can you provide me with steps to recreate?

On 2015-09-03 13:37:55 -0400, Manuel Dominguez wrote:

Hi James, I don't know. This is, again my log:

09-03 18:48:09.031 1971-1971/com.enzinatec.sexcheer D/AlarmPingSender� Ping 1 times.
09-03 18:48:09.031 1971-1971/com.enzinatec.sexcheer D/AlarmPingSender� Check time :1441298889031
09-03 18:48:09.031 1971-1971/com.enzinatec.sexcheer D/AlarmPingSender� Schedule next alarm at 1441298949031
09-03 18:49:09.051 1971-1971/com.enzinatec.sexcheer D/AlarmPingSender� Ping 1 times.
09-03 18:49:09.051 1971-1971/com.enzinatec.sexcheer D/AlarmPingSender� Check time :1441298949051
09-03 18:49:09.052 1971-1971/com.enzinatec.sexcheer E/ClientState� manolodd-1403284640: Timed out as no activity, keepAlive=60,000 lastOutboundActivity=1,441,298,889,031 lastInboundActivity=1,441,298,791,867 time=1,441,298,949,051 lastPing=1,441,298,889,031
09-03 18:49:09.054 1971-1971/com.enzinatec.sexcheer D/AlarmPingSender� Failure. Release lock(MqttService.client.manolodd-1403284640):1441298949054
09-03 18:49:09.055 1971-1971/com.enzinatec.sexcheer D/AlarmPingSender� Unregister alarmreceiver to MqttServicemanolodd-1403284640

I'm using these values:

private static final int CONNECTION_KEEPALIVE_SECONDS = 1 * 60; // One minute
private static final int CONNECTION_TIMEOUT_MILLISECONDS = 10 * 60 * 1000;  // Ten minutes

For keepalive and connection timeout respectively.

This is my connectionLost() implementation:

@Override
public void connectionLost(Throwable throwable) {
    // If we're here is because we were connected. So, connLost=true means that the client
    // was connected, was disconnected due to a network failure and it was impossible to
    // connect. So, reconnection is needed as soon as possible.
    broadcastConnectivityInfo(FlowManager.FM_CI_MESSAGE_CONNECTION_UNAVAILABLE);
    Log.d(TAG, "conectionLost(...)");
    this.connLost = true;
    this.subscriptions.clear();
    if (mqttClient != null) {
        Log.d(TAG, "Connection lost");
        if (this.deviceIsOnline()) {
            Log.d(TAG, "Reconnecting...");
            this.autoReconnectLogic();
        } else {
            Log.d(TAG, "No other network available.");
            this.autoReconnectLogic();
        }
    }
}

I expected that at least Log.d(TAG, "conectionLost(...)"); was executed, but... it is not.

The other two methods of MqttCallback interface works fine.

I have one classs FlowManager that

  • Implements MqttCallback
  • Has an attribute of type MqttAndroidClient

In this class, once one wants to connect the MQTT is instantiated after setting up its options and setting its callbacks by calling mqttClient.setCallback(this); (mqttClient is of type MqttAndroidClient).

My test is:

  • Connect --> ok
  • Subscribe --> ok
  • Receive a message that I print --> ok
  • Disconnect the rj45 connector. No network available.
  • Wait for disconnection detection.
  • The message I have pasted is shown, but connectionLost() is not executed.

¿?¿?¿

Have you tried using MqttAndroidClient?

How can I help you more?

On 2015-09-04 05:13:41 -0400, James Sutton wrote:

Thank you Manuel, Could you tell me which version of the Android service library (org.eclipse.paho.android.service) you are using?

On 2015-09-04 08:56:13 -0400, Manuel Dominguez wrote:

Hi James,

until yesterday I was using version 1.0.2. But yesterday I updated them before building and executing the test corresponding to the log I posted. Now I'm using:

org.eclipse.paho.android.service-1.0.3-20150801.040645-132

and

org.eclipse.paho.client.mqttv3-1.0.3-20150801.040215-185

But, nothing changed :-(

On 2015-12-03 08:22:49 -0500, James Sutton wrote:

I've been following a number of similar bugs that seem to have been caused by network connectivity issues. Were you able to get this working with the latest snapshot or with a different broker i.e. iot.eclipse.org?

[feature] Reconnect after network recovery

migrated from Bugzilla #443359
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version 1.0 on platform Other
Assigned to: Tang Zi Han

On 2014-09-04 23:39:54 -0400, Zhang Yang wrote:

1)If the network recovery, make all connections to reconnect;
2)Set the same onSuccess/onFailure callback with connect action when reconnect.

On 2014-09-12 03:50:25 -0400, Tang Zi Han wrote:

Implemented in develop branch.

On 2014-09-12 03:51:00 -0400, Tang Zi Han wrote:

Implemented in develop branch

On 2014-09-12 05:36:54 -0400, Ian Craggs wrote:

Please describe the design.

Are there any API changes to control this reconnection?

Is there a delay backoff for increasing connection failures?

When is the onFailure callback called? On every failure to reconnect? If we are then going to attempt a reconnect again, should we actually call onFailure?

On 2014-09-15 02:20:29 -0400, Tang Zi Han wrote:

  1. No API changes.
  2. The detail design refers to https://bugs.eclipse.org/bugs/show_bug.cgi?id=443362
  3. If the server is not reached in the timeout interval, the onFailure is called . The behaviour is the same with other MQTT client.
    But in Android client, the client will try to connect again when onFailure is called and the network is available.
  4. The delay backoff for increasing connection failure will be added in https://bugs.eclipse.org/bugs/show_bug.cgi?id=443375

AlarmPingSender causes timeout on Android API >= 19

migrated from Bugzilla #469723
status RESOLVED severity minor in component MQTT-Android for 1.2
Reported in version 1.1 on platform All
Assigned to: James Sutton

Original attachment names and IDs:

On 2015-06-09 08:09:47 -0400, Panayiotis Pastos wrote:

Created attachment 254225
call setExact on higher API

The android service AlarmPingSender uses alarmManager.set() to schedule the next keepalive ping.

However, on Android API >= 19 this is not exact. When having set the keepalive value to 30 (which might be low but needed for some on unreliable connections of some users) every now and then the broker would kick the client off as it exceeded the timeout. This was due to alarm manager inaccuracies as a scheduled ping would be late for more than 15 seconds (which is the grace period of the broker).

To resolve this the setExact() method should be used offered by API 19 and above, which practically functions the same way as set on API < 19. This guarantees an on-time keepalive ping.

On 2015-08-12 09:25:18 -0400, James Sutton wrote:

More Details here: http://developer.android.com/reference/android/app/AlarmManager.html

On 2015-08-12 09:28:47 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/53638

On 2015-08-17 06:28:57 -0400, Ian Craggs wrote:

Assigning to James

On 2015-08-26 09:07:54 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54584

On 2015-08-27 07:48:18 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54678

On 2015-08-27 10:11:24 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/54678 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: e44b44f

On 2015-08-28 06:30:45 -0400, James Sutton wrote:

API check now in place.

Some connection status is not set appropriately

migrated from Bugzilla #443369
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform PC
Assigned to: Tang Zi Han

On 2014-09-05 01:53:55 -0400, Zhang Yang wrote:

Since there are many accesses to connect and reconnect, we should make sure that if the client is in the state of connecting or connected , the same client instance(same host\port\clientid) will not call connect or reconnect action again.

On 2014-10-09 02:35:24 -0400, Tang Zi Han wrote:

fixed in develop branch .
https://git.eclipse.org/r/#/c/34090/

On 2014-10-09 02:35:52 -0400, Tang Zi Han wrote:

fixed in develop branch .
https://git.eclipse.org/r/#/c/34090/

Android Service is not keeping connection alive on Android 5.1.1

migrated from Bugzilla #482442
status RESOLVED severity critical in component MQTT-Android for 1.2
Reported in version unspecified on platform Other
Assigned to: James Sutton

On 2015-11-18 02:26:52 -0500, Zaur Agamov wrote:

On my Samsung S6 Edge (Android 5.1.1) when a device goes into sleep mode, Paho client stops sending keep-alive pings and after keepAliveTimeout * 1.5 connection to MQTT-broker drops.

However, on Samsung Galaxy Ace with Android 4.2.2 everything works fine, device is keep sending the pings and connection is kept alive.

Here's ready to run android project: https://github.com/zaur/PahoAndroidService
It is basically Paho's sample project built with these instructions: https://eclipse.org/paho/clients/android/

The jar I'm using is mqttv3-1.0.2.jar.
Please have a look, I think it's a serious issue.
Thank you.

On 2015-11-18 03:45:28 -0500, Zaur Agamov wrote:

I thought the issue was with updated AlarmManager behaviour on SDK>=KitKat.
See http://stackoverflow.com/questions/19841532/set-alarm-from-android-4-4-kitkat

Tried this approach, but it didn't help.

On 2015-11-18 04:08:16 -0500, James Sutton wrote:

Hi Zaur,

Have you tried this with the SNAPSHOT version of the Android Service & MQTTv3 client?

Change your repository to: https://repo.eclipse.org/content/repositories/paho-snapshots/
Change the mqtt client & and Android service version to: 1.0.3-SNAPSHOT

We've done a fair bit on the AlarmPingSender over the last few months, but those changes are still in the develop branch for the time being.

On 2015-11-18 05:21:40 -0500, Zaur Agamov wrote:

Hey James,
unfortunately, it didn't help.

Updated project (uses 1.0.3-SNAPSHOT mqtt-client and service) - https://github.com/zaur/PahoAndroidService/tree/mqtt-1.0.3

I set the keepAlive time ==20 secs and connection timeout ==10 secs.
After going to sleep mode device still disconnects.

And just for visibility:
Here's screenshot from my device: https://dl.dropboxusercontent.com/u/6129677/mqtt_disconnected.jpg
And logs from HiveMQ:
2015-11-18 14:12:11,246 INFO - Client samsung-edge connected
2015-11-18 14:13:02,356 INFO - Client samsung-edge disconnected

On 2015-11-18 06:03:23 -0500, Zaur Agamov wrote:

Samsung Galaxy S5 with Android 5.0 is also disconnecting.
It worked a bit on Lenovo S-90 with Android 5.0.2 though, but finally also disconnected after 12 minutes of sleep time (keepAlive is 30 seconds).
Huawei ALE-L21 (Android 5.0) disconnected after 3 minutes.

Only Samsung Galaxy Ace (Android 4.2.2) works for me.

On 2015-11-18 08:44:15 -0500, Zaur Agamov wrote:

So, in the end I've found that 10 seconds keepAlive timeout works for me. Connection is persisted.
But if I increase it to 20 seconds, connection drops within 1-2 minutes.

On 2015-11-18 08:59:54 -0500, James Sutton wrote:

Do you have any logs for what happens when it disconnects?

Normally, I'd expect to see something lie this every time the keepalive is triggered:

11-18 13:58:40.940 611-611/org.eclipse.paho.android.service.sample D/AlarmPingSender: Ping 1 times.
11-18 13:58:40.941 611-611/org.eclipse.paho.android.service.sample D/AlarmPingSender: Check time :1447855120940
11-18 13:58:40.941 611-611/org.eclipse.paho.android.service.sample D/AlarmPingSender: Schedule next alarm at 1447855130941
11-18 13:58:41.136 611-1202/org.eclipse.paho.android.service.sample D/AlarmPingSender: Success. Release lock(MqttService.client.natsu):1447855121136

I'd be interested to see what happens when the client drops the connection. I.e. Was a ping ever sent, or did something else cause the connection to close?

On 2015-11-19 04:00:12 -0500, Zaur Agamov wrote:

The app just silently unregisters the alarmreceiver.

11-19 12:57:44.971 17741-17741/org.eclipse.paho.android.service.sample I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@25ed9d70 time:27952318
11-19 12:57:45.391 17741-21176/org.eclipse.paho.android.service.sample D/AlarmPingSender: Register alarmreceiver to MqttServiceMqttService.pingSender.edge
11-19 12:57:45.391 17741-21176/org.eclipse.paho.android.service.sample D/AlarmPingSender: Schedule next alarm at 1447923485406
11-19 12:57:50.401 17741-17741/org.eclipse.paho.android.service.sample W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
11-19 12:57:51.311 17741-17748/org.eclipse.paho.android.service.sample I/art: Debugger is no longer active
11-19 12:58:08.831 17741-17741/org.eclipse.paho.android.service.sample D/AlarmPingSender: Ping 1 times.
11-19 12:58:08.831 17741-17741/org.eclipse.paho.android.service.sample D/AlarmPingSender: Check time :1447923488844
11-19 12:58:08.841 17741-17741/org.eclipse.paho.android.service.sample D/AlarmPingSender: Schedule next alarm at 1447923508849
11-19 12:58:08.851 17741-21178/org.eclipse.paho.android.service.sample D/AlarmPingSender: Success. Release lock(MqttService.client.edge):1447923488862
11-19 12:58:38.871 17741-21176/org.eclipse.paho.android.service.sample D/AlarmPingSender: Unregister alarmreceiver to MqttServiceedge

On 2015-11-19 10:52:02 -0500, James Sutton wrote:

I've now been able to replicate this. The fact that it doesn't give any useful information as to why the connection was lost is aggravating. I'll see if I can add some more useful logging which might help us track down the issue.

On 2015-11-20 11:10:56 -0500, James Sutton wrote:

It's strange that this is happening so frequently for you, I wonder if it's a difference in brokers? (I was only able to trigger similar behaviour in the end by setting the keepAlive to 2 seconds which isn't very sensible).

It might be worth trying with iot.eclipse.org:1883 (which is running mosquitto) to see whether another broker behaves differently.

You could also add something to the connectionLost callback in your implementation of MqttCallback. You should be given an exception which might shed some more light on the cause of the disconnect.

On 2015-12-03 08:16:23 -0500, James Sutton wrote:

Hi, Any luck with using a mosquitto based broker?

can not build android service

migrated from Bugzilla #454198
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform PC
Assigned to: Zhang Yang

On 2014-12-05 01:25:17 -0500, � � wrote:

Sorry,poor English.
I have downloaded org.eclipse.paho.mqtt.java-1.0.0.zip and included the projects in Eclipse�but when build the projects, there are some errors:
The type MqttTokenAndroid must implement the inherited abstract method IMqttToken.getGrantedQos()
The type MqttTokenAndroid must implement the inherited abstract method IMqttToken.getResponse()
The type MqttTokenAndroid must implement the inherited abstract method IMqttToken.getSessionPresent()

On 2014-12-05 01:30:19 -0500, � � wrote:

sorry, should be "imported", not "included".

On 2014-12-10 04:02:07 -0500, Zhang Yang wrote:

Please use the latest code for android service.
The three methods does exist in MqttTokenAndroid and android service could be built normally. Thanks.

[feature] If connection failed to connect because of server not responding, mqtt android service should reconnect using certain strategy

migrated from Bugzilla #443375
status UNCONFIRMED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform Other
Assigned to: James Sutton

On 2014-09-05 02:30:34 -0400, Zhang Yang wrote:

If connection failed to connect because of server not responding, mqtt android service should not reconnect all the time. It is better to have a reconnect strategy, such as reconnect immediately at the first time, 5 seconds at the second time, 30 seconds at the third time, ..., until not reconnect.
Mqtt android service could provide API to let app customized the strategy.

On 2015-08-17 06:33:04 -0400, Ian Craggs wrote:

Assigning to James

Refine Android service sample

migrated from Bugzilla #447031
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform PC
Assigned to: Zhang Yang

On 2014-10-14 04:38:59 -0400, Tang Zi Han wrote:

Refine android service sample to test android service easily.

On 2014-11-10 02:31:22 -0500, Zhang Yang wrote:

https://git.eclipse.org/r/#/c/34837/

[feature] App is killed, after mqtt service is restarted, mqtt service should reconnect to the mqtt server

migrated from Bugzilla #443365
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform Other
Assigned to: Tang Zi Han

On 2014-09-05 01:16:55 -0400, Zhang Yang wrote:

App is killed, after mqtt service is restarted by mobile phone, mqtt service should auto reconnect original connections to the mqtt server.

On 2014-09-05 02:17:05 -0400, Zhang Yang wrote:

1)Persist the connection meta info in SQLite database;
2)Retrieve the connections info from database when the service is started(onCreate);
3)Using the retrieved info of connections to connect to server.
4)Delete connection info from SQLite database when call disconnect.

On 2014-09-12 03:58:50 -0400, Tang Zi Han wrote:

Add a 'mqttConnections' database to store connection meta info after connect success.
And retrive the connections info when the service restart to do reconnect .
Fixed in develop branch.

On 2014-09-12 05:34:07 -0400, Ian Craggs wrote:

Does the reconnect happen when the service is restarted or the application? Does the service have a life independent of the application?

How does the application control whether the reconnect happens or not? Can it? Are there API changes?

What if the reconnect fails - what happens then?

On 2014-09-18 17:37:35 -0400, Tang Zi Han wrote:

Implementation detail:

  1. No API changes;
  2. When call the connect action in MqttService, the service will persist the connection meta info into database(mqttConnections.db).
    And when disconnect action is called ,the certain connection info will be deleted from database.
  3. If the service or the application is restarted(both will call service onCreate event), it will firstly read connections info from database, and if the sistuation of auto connecting is met, the service will do connect for theses connections.
  4. The auto connection sistutation :
    4.1 network is available;
    4.2 notification callback is not null, refer to [https://bugs.eclipse.org/bugs/show_bug.cgi?id=443367]

On 2014-09-18 17:54:19 -0400, Tang Zi Han wrote:

(In reply to Ian Craggs from comment # 3)

Does the reconnect happen when the service is restarted or the application?
Does the service have a life independent of the application?

How does the application control whether the reconnect happens or not? Can
it? Are there API changes?

What if the reconnect fails - what happens then?

The application will get the connection object(MqttConnection object) by a unique connection handle (the combination of host,port,clientid and application id).
In the connection object(MqttConnection), there are method(MqttConnection.isConnected()) and property(MqttConnection.isConnecting) to check connection status to control whether the reconnect hanppens.
It's also refer to [https://bugs.eclipse.org/bugs/show_bug.cgi?id=443369]

On 2014-09-19 11:23:49 -0400, Ian Craggs wrote:

(In reply to Tang Zi Han from comment # 5)

(In reply to Ian Craggs from comment # 3)

Does the reconnect happen when the service is restarted or the application?
Does the service have a life independent of the application?

How does the application control whether the reconnect happens or not? Can
it? Are there API changes?

What if the reconnect fails - what happens then?

The application will get the connection object(MqttConnection object) by a
unique connection handle (the combination of host,port,clientid and
application id).
In the connection object(MqttConnection), there are
method(MqttConnection.isConnected()) and
property(MqttConnection.isConnecting) to check connection status to control
whether the reconnect hanppens.
It's also refer to [https://bugs.eclipse.org/bugs/show_bug.cgi?id=443369]

I don't think that really answers my questions, so can you tell me what API calls the application has to make on restarting, so that the automatic reconnection will work?

Thanks

can't reconnect after switching network from wifi to 4g

migrated from Bugzilla #479619
status RESOLVED severity critical in component MQTT-Android for 1.2
Reported in version unspecified on platform Other
Assigned to: James Sutton

On 2015-10-13 03:40:35 -0400, jinfeng zhang wrote:

first,i started the demo and connected on wifi,and then,i switched the network from wifi to 4g without exit the demo,the demo printed "connect lost" and reconnected failed with error such as "start agent error". From then on,i could not connect to the server any more.

On 2015-11-18 04:25:31 -0500, James Sutton wrote:

Hi Jinfeng,

Have you tried this with the SNAPSHOT version of the Android Service & MQTTv3 client?

Change your repository to: https://repo.eclipse.org/content/repositories/paho-snapshots/
Change the mqtt client & and Android service version to: 1.0.3-SNAPSHOT

We've done a fair bit on the Android Service over the last few months, but those changes are still in the develop branch for the time being.

I'm using the latest library from the snapshot repository and have not seen this behaviour, so upgrading might resolve this for you too.

On 2015-12-02 10:13:21 -0500, James Sutton wrote:

Hi, Any luck with using SNAPSHOT?

MqttService crashes when isOnline is called because getSystemService is returning null

migrated from Bugzilla #458689
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version unspecified on platform Other
Assigned to: James Sutton

Original attachment names and IDs:

On 2015-01-28 17:37:01 -0500, Ankur Vashi wrote:

Created attachment 250327
StackTrace

MqttService seems to be crashing when attempting a reconnect. Service tries to check if the device isOnline but fails because the ConnectivityManager is null. Not sure why this would be happening. The stack trace is attached.

On 2015-06-20 17:01:31 -0400, Elad Nava wrote:

Reproduced it here as well.

It's happening because of the following lines:

/**

  • @return whether the android service can be regarded as online
    */
    public boolean isOnline() {
    ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
    if (cm.getActiveNetworkInfo() != null
    && cm.getActiveNetworkInfo().isAvailable()
    && cm.getActiveNetworkInfo().isConnected()
    && backgroundDataEnabled) {
    return true;
    }

    return false;
    

    }

The solution would be to assign the active network info object to a temporary variable:
NetworkInfo info = cm.getActiveNetworkInfo();

  if (info != null && info.isAvailable() && info.isConnected())
    {
  return true;

}

On 2015-07-29 13:02:27 -0400, Marc Demierre wrote:

*** Bug 473775 has been marked as a duplicate of this bug. ***

On 2015-07-29 13:05:34 -0400, Marc Demierre wrote:

Reproduced on my device (Nexus 5, Android 5.1.1) as well, with the Paho client 1.0.2.

On 2015-08-17 06:31:13 -0400, Ian Craggs wrote:

Assigning to James

On 2015-08-28 06:32:50 -0400, James Sutton wrote:

I accidentally associated the gerrit change with the duplicate Bug 473775.
The change has been merged to develop.

Setting SSL keystore/truststore using properties on android doesn't work

migrated from Bugzilla #447763
status UNCONFIRMED severity normal in component MQTT-Android for 1.1
Reported in version 1.1 on platform Other
Assigned to: James Sutton

On 2014-10-18 03:21:48 -0400, Richard Lakatos wrote:

We were using the java paho mqtt client in an android app. We wanted to secure the channel using SSL. When trying to set the truststore using the 'com.ibm.ssl.trustStore' property we hit a problem. On android its not possible to provide an absolute file path. We tried using the 'file:///android_asset' shortcut, which points to the assets folder in the apk, but in the end we always received a FileNotfoundExcepion, because the link got transformed to '/file:/android_asset' somewhere along the way. We tested this with escaped '/'-s and any other combination we could think of, but always ended up with the same results.

In the end we solved the issue by using a custom SSLSocketFactory with the MqttClientOptions#setSSLFactory method.

We used your SSLSocketFactoryFactory class as a basis for it. We only had to change about 3 lines of code all together. We replaced the following in your private SSLContext getSSLContext(String configID) function:

trustStore=KeyStore.getInstance(trustStoreType);
trustStore.load(new FileInputStream(trustStoreName), trustStorePwd);

with these

trustStore = KeyStore.getInstance(trustStoreType);
FileInputStream fis =
this.context.getAssets().openFd(trustStoreName).createInputStream();
trustStore.load(fis, trustStorePwd);

and it worked like a charm.

My question is this: given that MQTT is aimed at mobile devices primarily, and this fix/enhancement would take minimal effort to include, as I described the solution above, would it be possible to add this change in the client so we won't have implement a custom SocketFactory every time on android?

On 2014-10-23 03:37:22 -0400, Bin Zhang wrote:

I think it's not a good idea to add android dependency to java client.
And we already have the MQTT Android service (http://www.eclipse.org/paho/clients/android/) which is based on the java client.

Probably, we can provide a default SSLSocketFactory implementation for MQTT Android service.

On 2014-10-23 04:04:56 -0400, Richard Lakatos wrote:

That's probably even better. At the time we started working on this project the mqtt android service wasn't around yet, that's why we moved in the direction I described.

On 2015-01-06 02:31:33 -0500, Bin Zhang wrote:

Assign to android component

On 2015-01-14 22:11:43 -0500, Tang Zi Han wrote:

You can refer to mqtt android service sample in org.eclipse.paho.mqtt.java/org.eclipse.paho.android.service/org.eclipse.paho.android.service.sample.

In ClientConnections L255 , it shows how to use ssl keystore.

On 2015-08-01 06:47:29 -0400, Manuel Dominguez wrote:

This is how we access the CA certificat in our case. It is located not in the /res folder but inside one of the packages:

public static InputStream getBrokerCAFileInputStream() {
    InputStream cafileInputStream = null;
    /*
      To make this work, it is necessary to put the following

        sourceSets {
            main {
                resources.srcDirs = ['src/main/java']
            }
        }

      inside the android {} section of build.gradle
     */
    cafileInputStream = ClientConfig.class.getResourceAsStream(ClientConfig.BROKER_CAFILE_NAME);
    return cafileInputStream;
}

BROKER_CAFILE_NAME is defined in the same class as:

private static final String BROKER_CAFILE_NAME = "/path/to/one/of/our/java/packages/CA.crt";

Perhaps it could be useful.

On 2015-08-17 06:32:30 -0400, Ian Craggs wrote:

Assigning to James

IMqttToken returned by MqttAndroidClient's methods trow exceptions in waitForCompletion(long timeout)

migrated from Bugzilla #474086
status UNCONFIRMED severity major in component MQTT-Android for 1.2
Reported in version 1.2 on platform PC
Assigned to: James Sutton

On 2015-08-01 06:22:56 -0400, Manuel Dominguez wrote:

Hi,

I've been trying to use MqttAndroidClient in a synchronous way by controlling the IMqttToken that its methods return. But each time I use:

IMqttToken.waitForCompletion(long timeout)

the timeout expires and a MqttException is thrown. However, most of the times the operations have been done fine, but the exception is thrown. Is the MqttAndroidClient supposed to work as the traditional MqttAsyncClient in relation to IMqttToken handling?

Regards.

On 2015-08-17 06:28:14 -0400, Ian Craggs wrote:

Assigning to James

Key android.intent.extra.ALARM_COUNT expected Integer but value was a java.lang.Long

migrated from Bugzilla #467954
status UNCONFIRMED severity normal in component MQTT-Android for 1.2
Reported in version unspecified on platform Other
Assigned to: James Sutton

Original attachment names and IDs:

On 2015-05-22 01:51:10 -0400, Guillermo Casanova wrote:

Created attachment 253655
Bug stacktrace

Paho android service AlarmPingSender class method on onReceive of the AlarmReceiver gets served a Long object but it expects an Integer. Check out the attached stacktrace.

On 2015-08-17 06:29:27 -0400, Ian Craggs wrote:

Assigning to James

On 2015-09-02 05:43:01 -0400, James Sutton wrote:

That's very strange.. I've had a dig through and everything I can find points to that value being an Integer, it's managed by the Android Alarm manager so I don't think it can be anything that the Android Mqtt Service is doing..

The only thing I could find that seems to match this is an issue on another Android OS project: mendhak/gpslogger#337

You're not using a Moto G by any chance are you?

They have a fix which looks like it will work, but it's likely that we would have to rely on you to make sure that it is fixed.(mendhak/gpslogger@SHA: 9ae9f295d218b5b89dce3e554e04207c1fc673d7)

On 2015-09-02 06:23:23 -0400, Guillermo Casanova wrote:

Hi James,

I mostly use a Moto G, that's correct. I will take a look at the fix you linked, thanks a lot.

On 2015-11-18 04:30:57 -0500, James Sutton wrote:

Hi Guillermo,

Did this work for you? If so it might be good to add it to the Android service properly so that Paho isn't broken on the Moto G.

[feature] mqtt service provide a callback interface to let user setup their own notification callback to notify connection has been reconnected during app is dead

migrated from Bugzilla #443368
status UNCONFIRMED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform Other
Assigned to: James Sutton

On 2014-09-05 01:48:57 -0400, Zhang Yang wrote:

First app is killed.
Then if connection's cleansession is set to true, after mqtt service is restarted and mqtt service auto reconnect original connections to the mqtt server.
In this situation, mqtt service need to provide a callback to let user setup their own notification callback to notify connection has been reconnected during app is dead. Then user could decide what to do after connection is auto connected, whether to reestablish the subscriptions which have been cleared out or not.

On 2015-08-17 06:33:32 -0400, Ian Craggs wrote:

Assigning to James

On 2015-11-27 09:31:58 -0500, James Sutton wrote:

Hi Zhang,
I think I understand what you're asking for. Would it not just be easier to implement the subscription / re-subscription in the main connection callback?

Check null when calling MqttAndroidClient#isConnected

migrated from Bugzilla #444318
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version unspecified on platform All
Assigned to: Zhang Yang

On 2014-09-16 22:14:03 -0400, Dave Jensen wrote:

If the MqttAndroidCilent has not performed a bind to the service, the mqttService local variable is null. If one tries to invoke isConnected() on MqttAndroidClient, an NPE will be thrown.

I suggest that a check for null is performed at this point. The connection is either not connected or in process of connecting both situations are !isConnected().

On 2014-09-20 11:10:51 -0400, Zhang Yang wrote:

Fixed in develop branch, Change-Id: ISHA: d698850b10e0707a195e279150c1483021e0f15e

startService(serviceStartIntent) called Twice

migrated from Bugzilla #470019
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version 1.2 on platform Other
Assigned to: James Sutton

On 2015-06-12 00:22:53 -0400, Dustin Thomson wrote:

In MqttAndroidClient::connect we have myContext.startService(serviceStartIntent) being called twice, nearly back to back. In the first instance we check the result of the method and throw an exception if it doesn't pass the assertion. Then we immediately re-call it. The second call seems unnecessary.

On 2015-06-12 06:10:05 -0400, Marc Pomar Torres wrote:

For me second call is unnecessary too, also makes android to call onStartCommand twice.

On 2015-09-01 06:33:28 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54973

On 2015-09-04 04:32:29 -0400, Ian Craggs wrote:

Assigning to James.

On 2015-09-04 04:32:55 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/54973 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: bf423fb

On 2015-09-04 04:38:57 -0400, James Sutton wrote:

This has been merged into the develop branch. Setting to resolved.

Check clientHandle=null when calling MqttAndroidClient#isConnected

migrated from Bugzilla #468142
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version 1.2 on platform All
Assigned to: Ian Craggs

On 2015-05-24 19:02:08 -0400, Dustin Thomson wrote:

If the android client (MqttAndroidClient) has been successfully connected, and is then disconnected, calling isConnected() throws a NullPointerException.

Steps to reproduce:

  1. Connect successfully to a Mqtt server
  2. Call MqttAndroidClient#disconnect
  3. Call MqttAndroidClient#isConnected

When the MqttAndroidClient is notified of a disconnection, it calls the disconnected method. This sets clientHandle = null. However, isConnected() then passes a null to mqttService.isConnected which results in a NullPointerException in MqttService#getConnection

On 2015-05-25 01:08:27 -0400, Dustin Thomson wrote:

I have a fix for this, just waiting for my CLA to propagate through the system.

On 2015-05-27 22:36:46 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/48826

On 2015-07-30 06:55:50 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/48826 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 78605e7

On 2015-07-30 06:56:34 -0400, Ian Craggs wrote:

Added to develop branch.

Error checking if is online

migrated from Bugzilla #481192
status CLOSED severity critical in component MQTT-Android for 1.2
Reported in version 1.2 on platform All
Assigned to: James Sutton

On 2015-11-01 14:03:40 -0500, Pablo aznarez wrote:

java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 (has extras) } in org.eclipse.paho.android.service.MqttService$NetworkConnectionIntentReceiver

On 2015-11-01 14:07:16 -0500, Pablo aznarez wrote:

Im doing an android app to manage hostalia and acens panels , and I can not deploy production to google play with this bug.
Regards.

On 2015-11-01 14:10:02 -0500, Pablo aznarez wrote:

This is all error bug

11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: FATAL EXCEPTION: main
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: Process: com.acens.aznarez.pablo.androidpanelcliente, PID: 17066
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 (has extras) } in org.eclipse.paho.android.service.MqttService$NetworkConnectionIntentReceiver@5605aa6
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:882)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.os.Looper.loop(Looper.java:211)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5389)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.NetworkInfo.isAvailable()' on a null object reference
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at org.eclipse.paho.android.service.MqttService.isOnline(MqttService.java:814)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at org.eclipse.paho.android.service.MqttService$NetworkConnectionIntentReceiver.onReceive(MqttService.java:796)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:872)
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739) 
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95) 
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.os.Looper.loop(Looper.java:211) 
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5389) 
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372) 
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) 
11-01 20:23:54.853 17066-17066/com.acens.aznarez.pablo.androidpanelcliente E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

On 2015-11-02 15:47:36 -0500, Pablo aznarez wrote:

*** Bug 481191 has been marked as a duplicate of this bug. ***

On 2015-11-12 06:06:11 -0500, James Sutton wrote:

Hi Pablo,

Looks like this was fixed in Bug 473775, if you change your dependency to use the SNAPSHOT repository then this should work.

Change your repository Url to: https://repo.eclipse.org/content/repositories/paho-snapshots/

On 2015-11-12 06:07:12 -0500, James Sutton wrote:

*** This bug has been marked as a duplicate of bug 473775 ***

On 2015-11-12 12:13:38 -0500, Pablo aznarez wrote:

hi James , installed and testing, thx a lot ;)

Error on checking if is online

migrated from Bugzilla #481191
status CLOSED severity critical in component MQTT-Android for 1.2
Reported in version 1.2 on platform All
Assigned to: James Sutton

On 2015-11-01 13:53:52 -0500, Pablo aznarez wrote nothing.
On 2015-11-02 15:47:36 -0500, Pablo aznarez wrote:

*** This bug has been marked as a duplicate of bug 481192 ***

Reconnection on network connectivity changes only works for cleanSession == false

migrated from Bugzilla #444718
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform Other
Assigned to: Zhang Yang

On 2014-09-22 05:32:27 -0400, Florian Kaltner wrote:

The reconnect() method in MqttConnection only does a reconnect, if cleanSession was set to false. According to the MQTT specification (see section 2.2) the cleanSession flag should not be evaluated by the client (if I understood correctly).

On 2014-09-23 01:23:40 -0400, Zhang Yang wrote:

Resolved in Bugzilla 443374

Wakelock not released

migrated from Bugzilla #480134
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version 1.0 on platform PC
Assigned to: James Sutton

On 2015-10-19 11:00:37 -0400, Benjamin Zaiser wrote:

Sometimes the wakelock created by the MQTT Android Service does not get released correctly. So the smartphone stays awake which causes the battery to drain faster. Source:

  • go to Android settings, battery, see "Awake" bar
  • additionally it is possible to list all current wake locks and there is one refering to Mqtt Android Service

This issue has already been reported on Stackoverflow: http://stackoverflow.com/questions/31780657/paho-mqtt-alarmpingsender-wakelock-stucked

I think the issue is in the AlarmReceiver. Maybe onFailure() is not called and therefore the wakelock stays active?!

It is very hard to reproduce the issue or to provide you more information. Is it possible to introduce a workaround? Like a timer, which will release the wakelock after 1min no matter if the onSuccess() or onFailure() has been called?

Thanks
Ben

On 2015-10-19 11:21:42 -0400, James Sutton wrote:

Hi,

Are you using the Release version or the SNAPSHOT? This looks like an issue that has been fixed but is currently only available in the SNAPSHOT repository.

In the pom file:
Change your repository to: https://repo.eclipse.org/content/repositories/paho-snapshots/
Change the mqtt client version to: 1.0.3-SNAPSHOT

On 2015-11-10 00:45:16 -0500, Kevin Cernekee wrote:

I'm seeing this error on both of my test devices, after leaving the app running in the background for several hours. BetterBatteryStats shows my app holding a "MqttService-" partial wakelock for hours on end, so the phone never enters deep sleep mode.

I was running:

org.eclipse.paho.client.mqttv3-1.0.2.jar
org.eclipse.paho.android.service-1.0.2.jar

Tonight I will repeat my test with:

org.eclipse.paho.client.mqttv3-1.0.3-20151110.050204-292.jar
org.eclipse.paho.android.service-1.0.3-20151110.050636-215.jar

One thing that worried me from a quick glance at the code was:

IMqttToken token = comms.checkForActivity();

[...]

token.setActionCallback(new IMqttActionListener() {

Can we assume that comms.checkForActivity() will never try to invoke the onSuccess / onFailure callbacks before they have been set up (e.g. from a background thread, or if an error is detected immediately)?

On 2015-11-10 09:53:13 -0500, James Sutton wrote:

Hi Kevin,

That's right, comms.checkForActivity() can only be called once the connection has been set up, so the callbacks should already be in place at this point.

On 2015-11-10 10:32:24 -0500, Kevin Cernekee wrote:

Unfortunately the wakelock problem is still present, even running SNAPSHOT.

On 2015-11-12 05:57:31 -0500, James Sutton wrote:

Hi Kevin, I've added some logging into my copy of the service and have tried it with the sample app.

11-12 10:28:02.223 28401-29499/org.eclipse.paho.android.sample D/AlarmPingSender: Register alarmreceiver to MqttServiceMqttService.pingSender.AndroidExampleClient
11-12 10:28:02.225 28401-29499/org.eclipse.paho.android.sample D/AlarmPingSender: Schedule next alarm at 1447324282225
11-12 10:28:02.233 28401-28401/org.eclipse.paho.android.sample I/ActionListener: 2KG8DDS1-iot.eclipse.org-AndroidExampleClient connected.
11-12 10:31:22.231 28401-28401/org.eclipse.paho.android.sample D/AlarmPingSender: Ping 1 times.
11-12 10:31:22.231 28401-28401/org.eclipse.paho.android.sample D/AlarmPingSender: Check time :1447324282231
11-12 10:31:22.233 28401-28401/org.eclipse.paho.android.sample D/AlarmPingSender: Schedule next alarm at 1447324482233
11-12 10:31:22.517 28401-29501/org.eclipse.paho.android.sample D/AlarmPingSender: Success. Release lock(MqttService.client.AndroidExampleClient):1447324282517
11-12 10:31:22.517 28401-29501/org.eclipse.paho.android.sample D/AlarmPingSender: RELEASING WAKE LOCK

This is being called here: https://github.com/eclipse/paho.mqtt.java/blob/develop/org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/AlarmPingSender.java#L160

I have to admit that I've not used BetterBatteryStats to check the wake lock (I don't want to root my phone), but on the normal battery screen the 'Awake' Section is mostly empty when my phone is unplugged and in standby even though the connection is open (Which I think means that the lock is not active).

Do you have logs from your app running which might show the lock not being released?

On 2015-11-12 10:54:38 -0500, Kevin Cernekee wrote:

After running the app for a few minutes, dumpsys power shows:

Wake Locks: size=1
PARTIAL_WAKE_LOCK 'MqttService.client.android-fa9d919c4221790e' (uid=10060, pid=22409, ws=null)

logcat -s "AlarmPingSender:*" shows an acquire without a matching release at 15:44:05.581:

11-12 15:39:01.201 15990 16010 D AlarmPingSender: Register alarmreceiver to MqttServiceMqttService.pingSender.android-fa9d919c4221790e
11-12 15:39:01.203 15990 16010 D AlarmPingSender: Schedule next alarm at 1447342801203
11-12 15:40:02.554 15990 15990 D AlarmPingSender: Ping 1 times.
11-12 15:40:02.554 15990 15990 D AlarmPingSender: Check time :1447342802554
11-12 15:40:02.555 15990 15990 D AlarmPingSender: Schedule next alarm at 1447342862555
11-12 15:40:02.566 15990 16012 D AlarmPingSender: Success. Release lock(MqttService.client.android-fa9d919c4221790e):1447342802566
11-12 15:41:03.550 15990 15990 D AlarmPingSender: Ping 1 times.
11-12 15:41:03.551 15990 15990 D AlarmPingSender: Check time :1447342863551
11-12 15:41:03.551 15990 15990 D AlarmPingSender: Schedule next alarm at 1447342923551
11-12 15:41:03.561 15990 16012 D AlarmPingSender: Success. Release lock(MqttService.client.android-fa9d919c4221790e):1447342863561
11-12 15:42:03.553 15990 15990 D AlarmPingSender: Ping 1 times.
11-12 15:42:03.553 15990 15990 D AlarmPingSender: Check time :1447342923553
11-12 15:42:03.554 15990 15990 D AlarmPingSender: Schedule next alarm at 1447342983554
11-12 15:42:03.562 15990 16012 D AlarmPingSender: Success. Release lock(MqttService.client.android-fa9d919c4221790e):1447342923562
11-12 15:43:04.593 15990 15990 D AlarmPingSender: Ping 1 times.
11-12 15:43:04.594 15990 15990 D AlarmPingSender: Check time :1447342984594
11-12 15:43:04.594 15990 15990 D AlarmPingSender: Schedule next alarm at 1447343044594
11-12 15:43:04.614 15990 16012 D AlarmPingSender: Success. Release lock(MqttService.client.android-fa9d919c4221790e):1447342984614
11-12 15:44:05.581 15990 15990 D AlarmPingSender: Ping 1 times.
11-12 15:44:05.581 15990 15990 D AlarmPingSender: Check time :1447343045581
11-12 15:44:05.581 15990 15990 D AlarmPingSender: Schedule next alarm at 1447343105581
11-12 15:45:05.602 15990 15990 D AlarmPingSender: Ping 1 times.
11-12 15:45:05.602 15990 15990 D AlarmPingSender: Check time :1447343105602
11-12 15:45:05.603 15990 15990 D AlarmPingSender: Schedule next alarm at 1447343165603
11-12 15:45:05.700 15990 16012 D AlarmPingSender: Success. Release lock(MqttService.client.android-fa9d919c4221790e):1447343105700
11-12 15:46:05.614 15990 15990 D AlarmPingSender: Ping 1 times.
11-12 15:46:05.615 15990 15990 D AlarmPingSender: Check time :1447343165615
11-12 15:46:05.615 15990 15990 D AlarmPingSender: Schedule next alarm at 1447343225615
11-12 15:46:05.729 15990 16012 D AlarmPingSender: Success. Release lock(MqttService.client.android-fa9d919c4221790e):1447343165729

The only intervening messages are:

11-12 15:44:05.581 15990 15990 D AlarmPingSender: Ping 1 times.
11-12 15:44:05.581 15990 15990 D AlarmPingSender: Check time :1447343045581
11-12 15:44:05.581 15990 15990 D AlarmPingSender: Schedule next alarm at 1447343105581
11-12 15:44:06.472 3949 4482 I hubconnection: hub is now resumed
11-12 15:44:08.514 3949 26240 D NetlinkSocketObserver: NeighborEvent{elapsedMs=1036011563, 192.168.1.1, [02A844CBC5CC], RTM_NEWNEIGH, NUD_REACHABLE}
11-12 15:44:12.443 3949 5089 D WifiStateMachine: L2Connected CMD_START_SCAN source -2 8094, 8099 -> obsolete
11-12 15:44:15.237 3949 26240 D NetlinkSocketObserver: NeighborEvent{elapsedMs=1036018285, 192.168.1.1, [02A844CBC5CC], RTM_NEWNEIGH, NUD_STALE}
11-12 15:44:17.676 3949 5089 D WifiStateMachine: L2Connected CMD_START_SCAN source -2 8098, 8099 -> obsolete
11-12 15:44:42.532 2810 2810 E QCALOG : [MessageQ] ProcessNewMessage: [LOWI-SERVER] unknown deliver target [OS-Agent]
11-12 15:45:05.602 15990 15990 D AlarmPingSender: Ping 1 times.
11-12 15:45:05.602 15990 15990 D AlarmPingSender: Check time :1447343105602
11-12 15:45:05.603 15990 15990 D AlarmPingSender: Schedule next alarm at 1447343165603
11-12 15:45:05.700 15990 16012 D AlarmPingSender: Success. Release lock(MqttService.client.android-fa9d919c4221790e):1447343105700

On 2015-11-13 14:33:45 -0500, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/60365

On 2015-11-13 14:41:04 -0500, Kevin Cernekee wrote:

Change 60365, applied to the develop branch, fixed this problem for me on both test devices. I ran them both overnight and neither one had a "stuck wakelock" anymore.

On 2015-11-14 15:52:40 -0500, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/60423

On 2015-11-16 05:24:37 -0500, James Sutton wrote:

Thanks for fixing this Kevin. I wasn't able to see the issue on my own device, but as it's not caused any regressions and it's fixed it for you, I'm happy for it to go in.

On 2015-11-16 06:23:06 -0500, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/60423 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 8a9c13d

Lint error: WrongManifestParent

migrated from Bugzilla #455849
status RESOLVED severity major in component MQTT-Android for 1.1
Reported in version unspecified on platform PC
Assigned to: Tang Zi Han

On 2014-12-20 09:51:40 -0500, Nicolas Schneider wrote:

Hi,

the AndroidManifest.xml has an error, the service tag must be included inside the application tag.

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

</application>
<service android:name="org.eclipse.paho.android.service.MqttService">
</service>

must be

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <service android:name="org.eclipse.paho.android.service.MqttService" />
</application>

There are still other lint issues, but those are only warnings, so I did not add them here.

Regards,
Nicolas Schneider

On 2015-01-06 04:20:44 -0500, Tang Zi Han wrote:

Put service tag under application in AndroidManifest.xml, https://git.eclipse.org/r/#/c/39024/
But there are not other warnings in eclipse environment. What's your build environment?

On 2015-01-11 09:02:42 -0500, Nicolas Schneider wrote:

You have now duplicated the tags in the manifest file.
I converted the project to be built with gradle and just run lint during the build.
For now, I just see an "OldTargetApi" warning (you are targeting sdk 19, but should target sdk 21), an incorrect wakelock usage in MqttService line 805 (the wakelock will not be released if any of the functions above it throw an exception, so you might want to wrap this in an try-finally block), and an "IconMissingDensityFolder" issue. The last one can be solved by removing all the drawable-* folders and removing the icon from the application manifest entry.
This is a library and does not have to provide an icon anyway.

I thought there were other warnings as well, but this is only the case for the sample project, which is not that important.

On 2015-01-14 21:55:02 -0500, Tang Zi Han wrote:

(In reply to Nicolas Schneider from comment # 2)

You have now duplicated the tags in the manifest file.
I converted the project to be built with gradle and just run lint during the
build.
For now, I just see an "OldTargetApi" warning (you are targeting sdk 19, but
should target sdk 21), an incorrect wakelock usage in MqttService line 805
(the wakelock will not be released if any of the functions above it throw an
exception, so you might want to wrap this in an try-finally block), and an
"IconMissingDensityFolder" issue. The last one can be solved by removing all
the drawable-* folders and removing the icon from the application manifest
entry.
This is a library and does not have to provide an icon anyway.

I thought there were other warnings as well, but this is only the case for
the sample project, which is not that important.

Remove the duplicated tag in https://git.eclipse.org/r/#/c/39638/
If add try-finally block the warning in eclipse is different with gradle. It will not be resolved in this bug.
The usage of wakelock in MqttService will be checked in another bug.

use Android service , mobile costs power consumption

migrated from Bugzilla #446241
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform PC
Assigned to: Zhang Yang

On 2014-10-07 22:47:29 -0400, Xiao Ye wrote:

when I use MQTT Android service for some time , my mobile prompts that the app cost more power consumption .If I use version-0.4 , it don't prompts.

On 2014-12-04 20:48:01 -0500, Zhang Yang wrote:

Could not reproduce the issue using our mobile phones.

MqttAndroidClient receives multiple simultaneous onFailure callbacks after calling connect more than once

migrated from Bugzilla #486520
status UNCONFIRMED severity normal in component MQTT-Android for 1.2
Reported in version 1.2 on platform Other
Assigned to: James Sutton

On 2016-01-25 18:03:42 -0500, Jeffrey Charles wrote:

I have some code that attempts to connect to MQTT again in 5 seconds if it fails to establish a connection (this is designed for a kiosk with no input devices attached so error handling options are kind of limited other than fully restarting the device). What I'm seeing is that if I pass an invalid MQTT URL, the number of times onFailure is called with the same IMqttToken instance starts increasing very quickly causing the application to crash. What I would expect is onFailure to be called once for a given connection attempt.

Here's some of the code, you can call connect() after creating the MqttAndroidClient with an invalid MQTT url and using MemoryPersistence to see a repro situation.

@DebugLog
private void connect() {
    MqttConnectOptions connectOptions = new MqttConnectOptions();
    final int TWO_SECONDS = 2000;
    connectOptions.setConnectionTimeout(TWO_SECONDS);
    try {
        mqttAndroidClient.connect(connectOptions, null, connectionCallback);
    } catch (MqttException e) {
        Timber.w(e, "Failed to connect to mqtt with MqttException");
        scheduleConnectAttempt();
    }
}

@DebugLog
private void scheduleConnectAttempt() {
    scheduledExecutorService.schedule(connectionRunnable, 5, TimeUnit.SECONDS);
}

@DebugLog
private class MqttConnectRunnable implements Runnable {
    @Override
    public void run() {
        try {
            connect();
        } catch (Throwable t) {
            Timber.e(t, "Got exception during connect");
        }
    }
}

@DebugLog
private class MqttConnectionCallback implements IMqttActionListener {
    @Override
    public void onSuccess(IMqttToken iMqttToken) {
        eventBus.post(new ConnectedToMqtt());
    }

    @Override
    public void onFailure(IMqttToken iMqttToken, Throwable throwable) {
        Timber.w(throwable, "Failed to connect to mqtt");
        scheduleConnectAttempt();
    }
}

I suspect the source of the problem is the unguarded call to registerReceiver(MqttAndroidClient.this) on line 433 in org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service/MqttAndroidClient.java. Calling registerReceiver with the same object multiple times will result in that object receiving any single broadcast the same number of times it was registered. In my case, calling connect multiple times causes registerReceiver to add the instance as a new receiver each time which causes onReceive to get called that many times for any given single connection attempt resulting in my onFailure method getting called that many times on failure for a given connection attempt. The behaviour I would expect is that registerReceiver would only get called once for a given instance of MqttAndroidClient.

On 2016-01-26 05:23:12 -0500, James Sutton wrote:

Hi, I believe that this issue has been resolved in the develop branch.
Could you try this with the SNAPSHOT version of the Android Service & MQTTv3 client?

Change your repository to: https://repo.eclipse.org/content/repositories/paho-snapshots/
Change the mqtt client & and Android service version to: 1.0.3-SNAPSHOT

file is broken when clone this repo.

migrated from Bugzilla #481902
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version unspecified on platform Macintosh
Assigned to: James Sutton

Original attachment names and IDs:

On 2015-11-11 01:16:00 -0500, alex wong wrote:

Created attachment 257873
snapshot with my problem

When I opened this downloaded git repo , I found the android service file is broken and cannot be opened , but source code in git server is good.
Please check out what it is problems on earth , and give an e-mail feedback.

On 2015-11-11 04:24:34 -0500, James Sutton wrote:

Hi Alex,

I've just cloned the git repository using 'git clone https://git.eclipse.org/r/paho/org.eclipse.paho.mqtt.java' and can access the directory 'org.eclipse.paho.android.service' without any problems. Could you try re-cloning the directory please? You could also try accessing the directory from the terminal.

On 2015-11-11 05:40:38 -0500, alex wong wrote:

Created attachment 257875
snapshot in mqttv3 internal package

Snapshot in mqttv3 internal package.
I couldn't find the file named 'ClienComms.java' which other files would depend on in git server. this attachment is a snapshot of my srceen.
And any suggestions could send me e-mail,thanks again.

On 2015-11-11 10:14:22 -0500, James Sutton wrote:

Hi Alex,

You want to look inside:

./org.eclipse.paho.mqtt.java/org.eclipse.paho.client.mqttv3/src/main/java-templates/org/eclipse/paho/client/mqttv3/internal
instead of :
./org.eclipse.paho.mqtt.java/org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/

The full file path is: ./org.eclipse.paho.mqtt.java/org.eclipse.paho.client.mqttv3/src/main/java-templates/org/eclipse/paho/client/mqttv3/internal/ClientComms.java

On 2015-11-11 10:15:07 -0500, James Sutton wrote:

Link: https://github.com/eclipse/paho.mqtt.java/tree/master/org.eclipse.paho.client.mqttv3/src/main/java-templates/org/eclipse/paho/client/mqttv3/internal

On 2015-11-18 04:20:42 -0500, James Sutton wrote:

Hi Alex, Any update on this? Or can I close the bug?

Android Service is limited to SSL 3.0

migrated from Bugzilla #476863
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version unspecified on platform PC
Assigned to: James Sutton

On 2015-09-08 06:55:31 -0400, James Sutton wrote:

The MqttAndroidClient forces SSL connections to SSL 3.0 or lower which have known vulnerabilities. You should at least be forced to TLSv1.2 or have the ability to choose the protocol.

On 2015-11-26 10:13:29 -0500, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/61344

On 2015-11-26 17:41:33 -0500, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/61344 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 450c508

Sample app shows duplicate notifications

migrated from Bugzilla #476108
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version unspecified on platform Other
Assigned to: James Sutton

On 2015-08-28 05:44:24 -0400, James Sutton wrote:

When the connection is opened or reopened in the sample app, the number of notifications for that even increases by one.
e.g.
First Connect: One notification.
Second Connect: Two notifications.
Third Connect: Three notifications.
And so on..

This seems to only be a presentation issue as I've made sure that only one tcp connection is open on the phone to the broker.

On 2015-09-01 05:11:11 -0400, James Sutton wrote:

This is a duplicate of Bug 462619. Which has been fixed.

*** This bug has been marked as a duplicate of bug 462619 ***

Java websocket client does not handle end of input after broker closes connection

migrated from Bugzilla #488345
status UNCONFIRMED severity major in component MQTT-Android for 1.2
Reported in version future on platform Macintosh
Assigned to: James Sutton

On 2016-02-23 21:05:25 -0500, Vineet Dixit wrote:

Java Websocket client throws IO exception due to error shown below when broker closes the connection. This is observed on the development branch org.eclipse.paho.client.mqttv3-1.0.3-SNAPSHOT.jar. Some details are included in this thread https://www.eclipse.org/forums/index.php/t/1075009/

Publishing at: 2016-02-22 22:59:03.496 to topic "mqtt/demo" qos 2
WebSocketReceiver.java : run(): Exception Occured.
java.io.IOException: Invalid Frame: Opcode: 15
at org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketFrame.(WebSocketFrame.java:187)
at org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketReceiver.run(WebSocketReceiver.java:98)
at java.lang.Thread.run(Thread.java:745)
Disconnected

Migrate Android Service Project to Android Studio / Gradle

migrated from Bugzilla #474722
status RESOLVED severity enhancement in component MQTT-Android for 1.2
Reported in version 1.1 on platform All
Assigned to: James Sutton

On 2015-08-11 11:41:46 -0400, James Sutton wrote:

Currently the Android service is a maven project. Android have moved their IDE of choice to Android Studio and so it would be good to migrate the project to it to make it easier to develop. This should be the same for the sample app as well.

On 2015-08-11 11:43:16 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/53578

WARNING: this patchset contains 1837 new lines of code and may require a Contribution Questionnaire (CQ) if the author is not a committer on the project. Please see:https://wiki.eclipse.org/Project_Management_Infrastructure/Creating_A_Contribution_Questionnaire

On 2015-08-17 06:26:52 -0400, Ian Craggs wrote:

Assigning to James

On 2015-08-20 11:09:47 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54238

On 2015-08-26 10:51:26 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54594

On 2015-08-26 12:48:31 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/54594 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: d7bf860

On 2015-08-27 09:57:39 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54701

On 2015-08-27 10:12:38 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/54701 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 2bc3953

On 2015-08-27 10:40:17 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54705

On 2015-09-01 11:00:16 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/55011

On 2015-09-03 08:31:29 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/55196

On 2015-09-04 04:34:51 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/55011 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: cc12301

On 2015-09-04 04:35:23 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/55196 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 8b10168

On 2015-09-07 10:49:13 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/55412

On 2015-09-08 03:28:23 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/55412 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 844ebf3

On 2015-09-14 06:12:58 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/55845

On 2015-09-14 08:25:51 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/55845 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: c13f6d3

On 2015-09-14 09:47:50 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/55867

On 2015-09-15 09:47:53 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/55867 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 40bb409

On 2015-09-16 04:38:15 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/56066

On 2015-09-16 05:51:03 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/56066 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: fa18abe

On 2015-10-07 10:14:12 -0400, James Sutton wrote:

The Android Service and example have been in gradle format for a few weeks now. Aside from issues with the service itself (Stability) there haven't been any issues with the build structure. As such I'll resolve this and open any future issues as new bugs.

Occasional NullPointerException in library when network connection changes

migrated from Bugzilla #473775
status CLOSED severity major in component MQTT-Android for 1.2
Reported in version 1.2 on platform Other
Assigned to: Ian Craggs

Original attachment names and IDs:

On 2015-07-28 13:12:20 -0400, Marc Demierre wrote:

Created attachment 255490
Exception stack trace

There seems to be a bug in the android client when the connection changes rapidly (for example when having a wonky wifi connection and Android changes quickly between wifi and mobile network).

The client has been created this way:

mMqttAndroidClient = new MqttAndroidClient(mContext, CommonConfig.MQTT_SERVER_URI, StaticConfig.MQTT_CLIENT_ID);
MqttConnectOptions options = new MqttConnectOptions();
options.setCleanSession(false);

try {
    mMqttAndroidClient.connect(options, null, this);
} catch (MqttException e) {
    Timber.e(e, "MQTT connection error");
}

The client connects fine, and can receive and publish messages. When the network connectivity changes, it usually calls connectionLost() and reconnects fine by itself.

But sometimes, the exception (stacktrace attached) occurs. The service crashes and does not throw anything back to my app. The exception happens internally when receiving the Broadcast android.net.conn.CONNECTIVITY_CHANGE.

I consider this bug major since it cannot be worked around by the application.

Please ask for any details you need.

My device: Nexus 5, Android 5.1.1, all updates installed

Paho library in build.gradle:
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}

On 2015-07-29 03:17:10 -0400, bob Wen wrote:

same as https://bugs.eclipse.org/bugs/show_bug.cgi?id=458689

simply change org.eclipse.paho.android.service.MqttService.isOnline to this:

    NetworkInfo info = cm.getActiveNetworkInfo();

  if (info != null && info.isAvailable() && info.isConnected())
    {
  return true;

}

will fix the bug.

On 2015-07-29 13:02:27 -0400, Marc Demierre wrote:

Sorry for the duplicate, I didn't catch the existing bug report.

It is here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458689

*** This bug has been marked as a duplicate of bug 458689 ***

On 2015-08-13 05:47:58 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/53692

On 2015-08-26 08:50:17 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54579

On 2015-08-26 08:59:07 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/54579 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 20327f4

On 2015-11-12 06:07:12 -0500, James Sutton wrote:

*** Bug 481192 has been marked as a duplicate of this bug. ***

After receiving connectionLost, calling connect again results in BroadcastReceiver being registered multiple times

migrated from Bugzilla #462619
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.2 on platform PC
Assigned to: Zhang Yang

Original attachment names and IDs:

On 2015-03-19 20:21:22 -0400, Mike Chen wrote:

Created attachment 251773
screen shot of related code

When calling connect again after initial connect (for exmaple attempt to reconnect after connectionLost is received), registerReceiver() is always called even if receiver has already been registered. This results in receiver receiving multiple copies of the same bundle from the service.

Highlighted lines in attached screenshot is the code in MqttAndroidClient.java that registers receiver even if the same receiver has already been registered.

On 2015-05-27 22:32:41 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/48825

On 2015-07-30 02:20:38 -0400, Hunt Lin wrote:

Can someone tell me why this can not be committed ?

On 2015-07-30 04:37:09 -0400, James Sutton wrote:

This can happen when a second change goes into the repository between you committing and the change being merged. I think the change will need to be rebased (https://www.mediawiki.org/wiki/Gerrit/resolve_conflict).

On 2015-07-30 06:36:46 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/48825 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 91320f7

On 2015-07-30 06:48:23 -0400, Ian Craggs wrote:

Change accepted in develop branch.

On 2015-08-29 05:28:20 -0400, Mirko Kohns wrote:

In the current (08/29/2015) develop branch this change is NOT included?
Can you please check?

On 2015-08-29 05:34:55 -0400, Mirko Kohns wrote:

Created attachment 256227
short overview of issue

On 2015-09-01 04:34:37 -0400, James Sutton wrote:

Looks like I accidentally undid this during Bug 474722. (The Migration to Android Studio). Sorry about that, I'll put a fix in now.

On 2015-09-01 04:39:15 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54961

On 2015-09-01 05:11:11 -0400, James Sutton wrote:

*** Bug 476108 has been marked as a duplicate of this bug. ***

On 2015-09-01 05:36:08 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/54961 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: bbd3916

After reconnection, the callbacks will be called multiple times.

migrated from Bugzilla #482634
status UNCONFIRMED severity normal in component MQTT-Android for 1.2
Reported in version v0.5 on platform Other
Assigned to: James Sutton

Original attachment names and IDs:

On 2015-11-19 19:02:34 -0500, Luxi Liu wrote:

Hi There,

I'm using 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.3-SNAPSHOT' and 'org.eclipse.paho:org.eclipse.paho.android.service:1.0.3-SNAPSHOT' to develop an Android app, which subscribes topics for messages from our own MQTT server.

As the MQTT server is not pingable, if there's no message coming, after the keep-alive-interval, the connection will be lost. On user's appropriate operation, the app will re-connect to the server if MqttAndroidClient.isConnected() returns false.

Then problem is:
The callback onSuccess() of MqttAndroidClient.connect() for this reconnection attempt, will be called twice. And the callback messageArrived() for the subscribed message coming through, will be called twice as well.
If the app re-connects for the 3rd time, the callbacks will be called 3 times; 4th, 4 times; 5th, 5 times; ...

I tried MqttAndroidClient.setKeepAliveInterval(), but it seems this API doesn't work at all, because no matter what value I set, the connection is always lost after 60 secs.

Initially, I used the libraries of 1.0.2 in release repo and I met this problem. Still no luck after changing to 1.0.3 in snapshot repo.

I found a similar bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=462619, which was already fixed. I'm not sure whether they're related or not.

Thank you!

On 2015-11-19 19:20:41 -0500, Luxi Liu wrote:

Confirm that SNAPSHOT has fixed this issue. But setKeepAliveInterval() still doesn't work in this case.

Thanks.

On 2015-11-25 06:37:53 -0500, James Sutton wrote:

Hi Luxi,

The Keep Alive value is only sent when the client connects to the server. Once that has happened, that value will be used for the remainder of the connection and cannot be changed.

It sounds like you're trying to change the keep alive after you have connected which would not have any effect on the connection. But MqttAndroidClient doesn't have a setKeepAliveInterval so I'm guessing that you're actually talking about MqttConnectOptions right?

On 2015-11-25 18:21:59 -0500, Luxi Liu wrote:

(In reply to James Sutton from comment # 2)

Hi Luxi,

The Keep Alive value is only sent when the client connects to the server.
Once that has happened, that value will be used for the remainder of the
connection and cannot be changed.

It sounds like you're trying to change the keep alive after you have
connected which would not have any effect on the connection. But
MqttAndroidClient doesn't have a setKeepAliveInterval so I'm guessing that
you're actually talking about MqttConnectOptions right?

Yes, it's MqttConnectOptions. The code is as below,

MqttConnectOptions mqttConnectOptions = new MqttConnectOptions();
mqttConnectOptions.setUserName(getUsername());
mqttConnectOptions.setPassword(getAccessToken().toCharArray());
mqttConnectOptions.setKeepAliveInterval(60 * 5);

mMqttAndroidClient.connect(mqttConnectOptions(), null, this);

No matter what value I give to setKeepAliveInterval(), the connected connection always connectionLost() after 60 sec, which is default value.

On 2015-11-27 08:34:04 -0500, James Sutton wrote:

I've not been able to recreate this on my nexus 5 with the sample app. What type of MQTT broker are you using? I've tested with the Mosquitto Broker on iot.eclipse.org which seems to work well.

On 2015-11-27 17:43:33 -0500, Luxi Liu wrote:

(In reply to James Sutton from comment # 4)

I've not been able to recreate this on my nexus 5 with the sample app. What
type of MQTT broker are you using? I've tested with the Mosquitto Broker on
iot.eclipse.org which seems to work well.

Try with an unpingable broker

On 2015-11-30 04:50:17 -0500, James Sutton wrote:

(In reply to Luxi Liu from comment # 5)

(In reply to James Sutton from comment # 4)

I've not been able to recreate this on my nexus 5 with the sample app. What
type of MQTT broker are you using? I've tested with the Mosquitto Broker on
iot.eclipse.org which seems to work well.

Try with an unpingable broker

If a broker does not respond to a PINGREQ then it is not compliant with the MQTTv3.1.1 spec and so would not be supported. http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718081

What broker does not respond to PINGREQs and why would you want to use it over other types?

On 2015-11-30 19:19:42 -0500, Luxi Liu wrote:

(In reply to James Sutton from comment # 6)

(In reply to Luxi Liu from comment # 5)

(In reply to James Sutton from comment # 4)

I've not been able to recreate this on my nexus 5 with the sample app. What
type of MQTT broker are you using? I've tested with the Mosquitto Broker on
iot.eclipse.org which seems to work well.

Try with an unpingable broker

If a broker does not respond to a PINGREQ then it is not compliant with the
MQTTv3.1.1 spec and so would not be supported.
http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.
html#_Toc398718081

What broker does not respond to PINGREQs and why would you want to use it
over other types?

It's an internally used server.

So for an unable-to-ping server, setKeepAliveInterval() cannot work?

The actual problem becomes:

  1. Connected to this unable-to-ping server with setKeepAliveInterval(300), 2. There's no message coming through within 300 secs, and at the same time, the ping message is not responded.
  2. After 60 secs, which is the default, the connection is lost.

On 2015-12-01 04:07:00 -0500, James Sutton wrote:

Right, I was thrown because in your example you were setting a keep alive value. If any keepalive interval is set, the client will also disconnect because the server is not responding. Set the keepalive interval to 0 which will disable keepalive processing in the client.

On 2015-12-01 08:21:27 -0500, Luxi Liu wrote:

(In reply to James Sutton from comment # 8)

Right, I was thrown because in your example you were setting a keep alive
value. If any keepalive interval is set, the client will also disconnect
because the server is not responding. Set the keepalive interval to 0 which
will disable keepalive processing in the client.

Unfortunately, setKeepAliveInterval(0) doesn't work, after 60 sec, the connection is still lost.

On 2015-12-01 08:44:12 -0500, Luxi Liu wrote:

The connection is SSL via port 8883.

On 2015-12-01 08:51:36 -0500, James Sutton wrote:

Created attachment 258391
Log file showing connection with keepalive of 0

On 2015-12-01 08:55:03 -0500, James Sutton wrote:

Comment on attachment 258391
Log file showing connection with keepalive of 0

12-01 13:43:22.667 24706-25857/org.eclipse.paho.android.sample D/AlarmPingSender: Register alarmreceiver to MqttServiceMqttService.pingSender.AndroidExampleClient
12-01 13:43:22.669 24706-25857/org.eclipse.paho.android.sample D/AlarmPingSender: Schedule next alarm at 1448977402669
12-01 13:43:22.674 24706-24706/org.eclipse.paho.android.sample I/ActionListener: L73AFSOP-iot.eclipse.org-AndroidExampleClient connected.
12-01 13:43:22.674 24706-24706/org.eclipse.paho.android.sample I/ActionListener: Auto-subscribing to: /jsutton23/test@ QoS: 0
12-01 13:43:27.672 24706-24706/org.eclipse.paho.android.sample D/AlarmPingSender: Ping 1 times.
12-01 13:43:27.672 24706-24706/org.eclipse.paho.android.sample D/AlarmPingSender: Check time :1448977407672
12-01 13:43:55.006 24706-24706/org.eclipse.paho.android.sample I/System.out: GOT A MESSAGE in history Incoming Message Test
12-01 13:43:55.006 24706-24706/org.eclipse.paho.android.sample I/System.out: M: 1
12-01 13:43:55.014 24706-24706/org.eclipse.paho.android.sample I/MqttCallbackHandler: Received message Incoming Message Test
Topic: /jsutton23/test;qos:0;retained:false
12-01 13:48:13.437 24706-24706/org.eclipse.paho.android.sample I/System.out: GOT A MESSAGE in history Incoming Message Test
12-01 13:48:13.438 24706-24706/org.eclipse.paho.android.sample I/System.out: M: 2
12-01 13:48:13.439 24706-24706/org.eclipse.paho.android.sample I/MqttCallbackHandler: Received message Incoming Message Test
Topic: /jsutton23/test;qos:0;retained:false
12-01 13:48:23.616 24706-30786/org.eclipse.paho.android.sample D/AlarmPingSender: Unregister alarmreceiver to MqttServiceAndroidExampleClient

On 2015-12-01 08:56:14 -0500, Luxi Liu wrote:

(In reply to James Sutton from comment # 12)

Comment on attachment 258391 [details]
Log file showing connection with keepalive of 0

12-01 13:43:22.667 24706-25857/org.eclipse.paho.android.sample
D/AlarmPingSender: Register alarmreceiver to
MqttServiceMqttService.pingSender.AndroidExampleClient
12-01 13:43:22.669 24706-25857/org.eclipse.paho.android.sample
D/AlarmPingSender: Schedule next alarm at 1448977402669
12-01 13:43:22.674 24706-24706/org.eclipse.paho.android.sample
I/ActionListener: L73AFSOP-iot.eclipse.org-AndroidExampleClient connected.
12-01 13:43:22.674 24706-24706/org.eclipse.paho.android.sample
I/ActionListener: Auto-subscribing to: /jsutton23/test@ QoS: 0
12-01 13:43:27.672 24706-24706/org.eclipse.paho.android.sample
D/AlarmPingSender: Ping 1 times.
12-01 13:43:27.672 24706-24706/org.eclipse.paho.android.sample
D/AlarmPingSender: Check time :1448977407672
12-01 13:43:55.006 24706-24706/org.eclipse.paho.android.sample I/System.out:
GOT A MESSAGE in history Incoming Message Test
12-01 13:43:55.006 24706-24706/org.eclipse.paho.android.sample I/System.out:
M: 1
12-01 13:43:55.014 24706-24706/org.eclipse.paho.android.sample
I/MqttCallbackHandler: Received message Incoming Message Test

Topic: /jsutton23/test;qos:0;retained:false
12-01 13:48:13.437 24706-24706/org.eclipse.paho.android.sample I/System.out:
GOT A MESSAGE in history Incoming Message Test
12-01 13:48:13.438 24706-24706/org.eclipse.paho.android.sample I/System.out:
M: 2
12-01 13:48:13.439 24706-24706/org.eclipse.paho.android.sample
I/MqttCallbackHandler: Received message Incoming Message Test

Topic: /jsutton23/test;qos:0;retained:false
12-01 13:48:23.616 24706-30786/org.eclipse.paho.android.sample
D/AlarmPingSender: Unregister alarmreceiver to
MqttServiceAndroidExampleClient

In you log, you have got messages coming. Have you try if no message coming and going at all?

On 2015-12-01 08:57:19 -0500, Luxi Liu wrote:

  1. setkeepalive(0)
  2. makre sure no message received or sent.
    after 60 secs, the connection will be lost

On 2015-12-01 09:03:58 -0500, James Sutton wrote:

So I gave it a try where I used the Sample App to connect to the mosquitto broker at iot.eclipse.org with a keepalive of 0.

As you can see in the attached log, the client connected to the broker at 13:43, auto subscribed to a topic and began a ping which immediately stopped because keepalive was set to 0. Note: It did not re-schedule. I then sent a test message, then waited about 5 minutes before sending another to make sure that the client was still connected and then disconnected.

If the connection is dropping for you, then it could be a genuine connectivity issue or an issue with your broker.

Do you have any logs to support that the keepalive value is not being honoured?

On 2015-12-02 01:22:18 -0500, Luxi Liu wrote:

(In reply to James Sutton from comment # 15)

So I gave it a try where I used the Sample App to connect to the mosquitto
broker at iot.eclipse.org with a keepalive of 0.

As you can see in the attached log, the client connected to the broker at
13:43, auto subscribed to a topic and began a ping which immediately stopped
because keepalive was set to 0. Note: It did not re-schedule. I then sent a
test message, then waited about 5 minutes before sending another to make
sure that the client was still connected and then disconnected.

If the connection is dropping for you, then it could be a genuine
connectivity issue or an issue with your broker.

Do you have any logs to support that the keepalive value is not being
honoured?

I can only see

D/AlarmPingSender: Unregister alarmreceiver to MqttServiceau.com.netcabs.oiii.352136069698666
D/ContentManager: MqttAndroidClient: connectionLost(In reply to James Sutton from comment # 15)

So I gave it a try where I used the Sample App to connect to the mosquitto
broker at iot.eclipse.org with a keepalive of 0.

As you can see in the attached log, the client connected to the broker at
13:43, auto subscribed to a topic and began a ping which immediately stopped
because keepalive was set to 0. Note: It did not re-schedule. I then sent a
test message, then waited about 5 minutes before sending another to make
sure that the client was still connected and then disconnected.

If the connection is dropping for you, then it could be a genuine
connectivity issue or an issue with your broker.

Do you have any logs to support that the keepalive value is not being
honoured?

I only have the following log

D/AlarmPingSender: Unregister alarmreceiver to MqttServiceau.com.abc.def.352136069698666
D/ContentManager: MqttAndroidClient: connectionLost

After 60 sec, the connect is lost. How can I get more detail log?

On 2015-12-02 05:33:12 -0500, James Sutton wrote:

Unfortunately for connectionLost there aren't really any more logs that could be shown. In your connectionLost callback, you could take the exception and print it to your console.

@OverRide
public void connectionLost(Throwable cause) {
if (cause != null) {
System.out.println("Connection Lost: " + cause.getMessage());
}
}

As you are also using a custom broker, you could try adding your own logging to that to look at the life cycle of the client. It may explain why your client is loosing the connection.

I recommend that you also test with iot.eclipse.org or a mosquitto broker to see if the client behaves the same way. If the client does not lose connection after 60 seconds then it is likely that the issue lies with either the route between the client and broker or the broker itself.

On 2015-12-17 09:55:35 -0500, James Sutton wrote:

Hi, Any Luck with this?

On 2015-12-21 22:11:42 -0500, Luxi Liu wrote:

(In reply to James Sutton from comment # 18)

Hi, Any Luck with this?

Hi,

I believe something's different with our own MQTT server, because the issue is not found with any other brokers

On 2015-12-22 06:36:31 -0500, Ian Craggs wrote:

Hi, James is on vacation now until January.

What would really help is to find out why the server is disconnecting the client. Depending on the MQTT server, there should be a log message or other explanation available. If this doesn't happen with any other MQTT server, maybe the server has a problem, or a mismatch in expectations between the client and server?

On 2015-12-22 16:14:56 -0500, Luxi Liu wrote:

(In reply to Ian Craggs from comment # 20)

Hi, James is on vacation now until January.

What would really help is to find out why the server is disconnecting the
client. Depending on the MQTT server, there should be a log message or
other explanation available. If this doesn't happen with any other MQTT
server, maybe the server has a problem, or a mismatch in expectations
between the client and server?

But I tried a ruby testing script, to connect first, sleep for more than 60 secs, then publish and receive message. The script can work, no auto disconnected issue

MultiDex support

migrated from Bugzilla #480092
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version unspecified on platform Other
Assigned to: James Sutton

On 2015-10-19 04:49:02 -0400, Sigitas Atkocaitis wrote:

adding
multiDexEnabled true
to build.gradle causes apk to generate two certificates, which makes apk not valid and unable to install into android device

On 2015-11-25 08:18:59 -0500, James Sutton wrote:

Hi Sigitas,

To which build.gradle are you adding multiDexEnabled? The Sample application does not need multiDex, nor does the Service.

On 2015-11-28 06:20:06 -0500, Sigitas Atkocaitis wrote:

multiDexEnabled true
I'am adding to app module build.gradle.
yes the sample app doesn't require multidexing. But if the app module exceeds the 65k method limit after compiling the apk it fails to install to device because the multiple certificate files

On 2015-11-30 04:31:46 -0500, James Sutton wrote:

This sounds like it is not an issue with the Android Service then, but with your own app. Maybe try on Stack overflow?

MqttConnection::disconnect will throw an exception if connect() has not been called

migrated from Bugzilla #475639
status RESOLVED severity normal in component MQTT-Android for 1.2
Reported in version 1.2 on platform Other
Assigned to: James Sutton

On 2015-08-22 19:09:24 -0400, Dustin Thomson wrote:

MqttConnection::disconnect can throw an exception if MqttConnection.connectOptions has not been set (either by calling connect() or explicitly setting it via setConnectOptions()

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.eclipse.paho.client.mqttv3.MqttConnectOptions.isCleanSession()' on a null object reference
at org.eclipse.paho.android.service.MqttConnection.disconnect(MqttConnection.java:460)
at org.eclipse.paho.android.service.MqttService.onDestroy(MqttService.java:610)
at android.app.ActivityThread.handleStopService(ActivityThread.java:2894)

On 2015-08-22 20:30:01 -0400, Eclipse Genie wrote:

New Gerrit change created: https://git.eclipse.org/r/54361

On 2015-08-25 15:28:01 -0400, Eclipse Genie wrote:

Gerrit change https://git.eclipse.org/r/54361 was merged to [develop].
Commit: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/commit/?id=SHA: 2e29c6f

On 2015-09-01 05:17:34 -0400, James Sutton wrote:

Setting as fixed.

NullPointer Exception when close SQLite db

migrated from Bugzilla #445298
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform Other
Assigned to: Zhang Yang

On 2014-09-28 21:11:50 -0400, Zhang Yang wrote:

[exec] Error in testConnect:
[exec] java.lang.NullPointerException
[exec] at org.eclipse.paho.android.service.DatabaseMessageStore.close(DatabaseMessageStore.java:425)
[exec] at org.eclipse.paho.android.service.MqttService.onDestroy(MqttService.java:693)
[exec] at android.test.ServiceTestCase.shutdownService(ServiceTestCase.java:265)
[exec] at android.test.ServiceTestCase.tearDown(ServiceTestCase.java:284)
[exec] at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
[exec] at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
[exec] at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:545)
[exec] at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)

On 2014-09-28 21:19:03 -0400, Zhang Yang wrote:

Fixed in develop branch and waiting for code merge.

Username not been send to moquitto

migrated from Bugzilla #481055
status CLOSED severity major in component MQTT-Android for 1.2
Reported in version 1.2 on platform PC
Assigned to: James Sutton

On 2015-10-29 16:01:40 -0400, Augusto Nishi wrote:

Hi, I have a mosquittio broker that requires username and password to be acessed, but if look at the logs, the android access does not have usernames, its trying to connect as anonymous.

I`m the code is some thiog like this, if i try to connectOptions.getUserName() it does return my username.

MqttConnectOptions connectOptions = new MqttConnectOptions();
connectOptions.setUserName("username");
connectOptions.setPassword("********");
mqttClient.connect(connectOptions, new IMqttActionListener() {

Am I doing something wrong? does it have something to do with the mosquitto or android configuration?

On 2015-11-18 04:23:31 -0500, James Sutton wrote:

Hi Augusto,

Simply change:

client.connect(connectOptions, new IMqttActionListener() {
to...
client.connect(connectOptions, null, new IMqttActionListener() {

The method you were using for connect actually accepts an Object as the first argument as it s a generic object that can be passed around as user context. It's a bit confusing that they swap and the first argument becomes options. I'll see if I can add some extra docs to make a point of that.

invoke IMqttActionListener.onSuccess() with "false" IMqttToken.

migrated from Bugzilla #466250
status UNCONFIRMED severity normal in component MQTT-Android for 1.1
Reported in version 1.1 on platform PC
Assigned to: James Sutton

On 2015-05-04 02:23:37 -0400, bob Wen wrote:

the IMqttActionListener.onSuccess callback be call with a fake IMqttToken(which created by first method call(eg. mqttClient.connect()).
the fake IMqttToken didn't contains server response which return by paho IMqttAsyncClient.

the user's IMqttActionListener callback will not be able to retrieve server's response.

if user call token.getResponse() in IMqttActionListener.onSuccess(token), it always throw NullPointException.

On 2015-08-17 06:30:43 -0400, Ian Craggs wrote:

Assigning to James

On 2015-11-30 09:37:40 -0500, James Sutton wrote:

Confirmed:
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: Process: org.eclipse.paho.android.sample, PID: 30274
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'org.eclipse.paho.client.mqttv3.internal.wire.MqttWireMessage org.eclipse.paho.client.mqttv3.IMqttToken.getResponse()' on a null object reference
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at org.eclipse.paho.android.service.MqttTokenAndroid.getResponse(MqttTokenAndroid.java:239)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at org.eclipse.paho.android.sample.activity.ActionListener.onSuccess(ActionListener.java:94)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at org.eclipse.paho.android.service.MqttTokenAndroid.notifyComplete(MqttTokenAndroid.java:124)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at org.eclipse.paho.android.service.MqttAndroidClient.simpleAction(MqttAndroidClient.java:1485)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at org.eclipse.paho.android.service.MqttAndroidClient.connectAction(MqttAndroidClient.java:1440)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at org.eclipse.paho.android.service.MqttAndroidClient.onReceive(MqttAndroidClient.java:1372)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-30 14:36:25.333 30274-30274/org.eclipse.paho.android.sample E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Provide Android client via Maven repo

migrated from Bugzilla #442921
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version future on platform All
Assigned to: Bin Zhang

On 2014-08-29 15:06:20 -0400, Adam Giemza wrote:

It would be nice if the Android client would be available via mvn as the Java (Desktop) client already is.

On 2014-09-18 05:59:58 -0400, Bin Zhang wrote:

Fixed in develop branch via https://git.eclipse.org/r/33546

On 2014-09-19 11:17:14 -0400, Al Stockdill-Mander wrote:

Do we actually have builds of the android client available to download from maven yet?

On 2014-09-19 12:05:32 -0400, Bin Zhang wrote:

The build will produce org.eclipse.paho.android.service-{VERSION}.jar in the org.eclipse.paho.mqtt.java/org.eclipse.paho.android.service/org.eclipse.paho.android.service/target directory. Exactly the similar way did for org.eclipse.paho.client.mqttv3-{VERSION}.jar. They are supposed to be copied to the right distribution repo, is that correct?

Attempt to release not held wakelock causes exception in AlarmPingSender when timeout

migrated from Bugzilla #485871
status UNCONFIRMED severity critical in component MQTT-Android for 1.2
Reported in version 1.2 on platform Other
Assigned to: James Sutton

On 2016-01-14 13:12:31 -0500, Mike Thomas wrote:

When connection fails due to

  • Timed out waiting for a response from the server (32000)
    or
  • timeout writing to server (32002)
    I have found that AlarmPingSender onRecieve method enters into the following section of code:
    if(token==null) {
    this.wakelock.release()
    }

The wakelock is not always held and without performing an isHeld() check beforehand, goes ahead and attempts to release the wakelock causing an app crashing exception.

I triggered this error by:

  • connecting the android devices to WiFi
  • connecting succesfully to the MQTT broker
  • removing the internet connection of WiFi source whilst maintaining the WiFi signal so the android device is still connected to WiFi but not actually to the internet.

Unfortunately this error doesn't seem to happen with the example application, but it does seem to come from the library and not from my code.

I am using the following library version:
org.eclipse.paho.android.service-1.0.3-20160114.051543-228.jar
org.eclipse.paho.client.mqttv3-1.0.3-20151112.050540-306.jar

Please see the log below for details:

12-15 17:09:22.718 15177-15177/com. E/ClientState: 5697e1e9eed6e625027d48f6: Timed out as no activity, keepAlive=2.000 lastOutboundActivity=1.450.195.760.714 lastInboundActivity=1.450.195.758.802 time=1.450.195.762.721 lastPing=1.450.195.760.714
12-15 17:09:22.748 15177-15177/ W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41750d58)
12-15 17:09:22.748 15177-15177/ E/AndroidRuntime: FATAL EXCEPTION: main
Process: com., PID: 15177
java.lang.RuntimeException: Error receiving broadcast Intent { act=MqttService.pingSender.5697e1e9eed6e625027d48f6 flg=0x14 (has extras) } in org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver@42254bc8
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:769)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: WakeLock under-locked MqttService.client.5697e1e9eed6e625027d48f6
at android.os.PowerManager$WakeLock.release(PowerManager.java:1044)
at android.os.PowerManager$WakeLock.release(PowerManager.java:1015)
at org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver.onReceive(AlarmPingSender.java:165)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:759)
at android.os.Handler.handleCallback(Handler.java:733) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5584) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) 
at dalvik.system.NativeStart.main(Native Method)

On 2016-01-15 07:29:02 -0500, Mike Thomas wrote:

Further details:
I downloaded the source code today to add the isHeld() check on the wakelock myself. The code section in question was nowhere to be found, and when I ran the app with the android service as an imported module in source code I had no issue.

The only place I have seen the offending section of code was in Android Studio when looking at the decompiled AlarmPingSender.class.

Dead links on homepage

migrated from Bugzilla #450278
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version unspecified on platform PC
Assigned to: Ian Craggs

On 2014-11-06 06:41:56 -0500, Thomas Schmidt wrote:

Android Service page on http://www.eclipse.org/paho/clients/android/ is full of links that don't work.

  1. Link to The Paho Android Service jar points to the homepage not the file download
  2. Link to the details of the getting started section is a dead link (404 File not found)

On 2015-04-28 10:03:45 -0400, Ian Craggs wrote:

I've updated those two links. Thanks

'Enable Logging' is not actually implemented Android sample

migrated from Bugzilla #442853
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 0.9 on platform PC
Assigned to: Tang Zi Han

On 2014-08-29 04:12:19 -0400, Tang Zi Han wrote:

In Android service sample, the 'Enable Logging' button in the top right bar is not actually implemented . If enable the button, I can not get MQTT Android service trace .

On 2014-09-03 05:42:31 -0400, Ian Craggs wrote:

Changing component to Android

On 2014-09-28 22:19:16 -0400, Tang Zi Han wrote:

Fixed in develop branch.
https://git.eclipse.org/r/#/c/33807/

Add and refine unit test cases

migrated from Bugzilla #443370
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform PC
Assigned to: Zhang Yang

On 2014-09-05 02:06:39 -0400, Zhang Yang wrote:

Add and refine unit test cases, such as add test case for cleanSession is set to true.

On 2014-12-01 01:27:12 -0500, Zhang Yang wrote:

Done in develop branch.

Refine documentation

migrated from Bugzilla #443371
status RESOLVED severity normal in component MQTT-Android for 1.1
Reported in version 1.0 on platform Other
Assigned to: Zhang Yang

On 2014-09-05 02:08:37 -0400, Zhang Yang wrote:

Refine documentation according to new added features and APIs.

On 2014-11-10 02:32:32 -0500, Zhang Yang wrote:

Done

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.