Can't fetch messages from GoTenna Mesh in Android

Dear all,

I’m having troubles running a simple app I wrote for Android.

I’m sending a simple letter in broadcast with:

sendToGT = (Button) findViewById(R.id.sendToGotenna);
sendToGT.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                GTTextOnlyMessageData message = new GTTextOnlyMessageData("a");
                gtCommandCenter.sendBroadcastMessage(message.serializeToBytes(),gtCommandResponseListener,errorone);
            } catch (Exception e) {
                Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_SHORT).show();
            }
        }
    });

And my callback is simply:

@Override
public void onIncomingMessage(GTBaseMessageData gtBaseMessageData)
{
    Toast.makeText(getApplicationContext(), gtBaseMessageData.getText(), Toast.LENGTH_SHORT).show();
}

It works, when I press the button I see the message getting sent and the receiving GoTenna lightning up, but the message doesn’t get delivered from the GoTenna to the app.
This is my trace:

11-16 14:11:37.425 9350-9396/? E/bt_btif: bta_gattc_cmpl_cback unknown conn_id = 4, ignore data
11-16 14:11:37.438 9668-10514/com.example.root.gotennaapp I/GTEventNotifier: COMMAND 174 STARTING: SENDING GET MESSAGE
11-16 14:11:37.496 9350-9396/? E/bt_btif: bta_gattc_cmpl_cback unknown conn_id = 4, ignore data
11-16 14:11:37.556 9350-9396/? E/bt_btif: bta_gattc_cmpl_cback unknown conn_id = 4, ignore data
11-16 14:11:37.617 9350-9396/? E/bt_btif: bta_gattc_cmpl_cback unknown conn_id = 4, ignore data
11-16 14:11:37.619 9668-9680/com.example.root.gotennaapp I/GTEventNotifier: GET MESSAGE via KEEP ALIVE - RESPONSE POSITIVE
11-16 14:11:37.653 9668-9668/com.example.root.gotennaapp I/GTEventNotifier: COMMAND 175 STARTING: DELETE LAST MESSAGE
11-16 14:11:37.888 9350-9396/? E/bt_btif: bta_gattc_cmpl_cback unknown conn_id = 4, ignore data
11-16 14:11:37.891 9668-10514/com.example.root.gotennaapp I/GTEventNotifier: DELETE LAST MESSAGE - RESPONSE POSITIVE
11-16 14:11:37.891 9668-10514/com.example.root.gotennaapp I/GTEventNotifier: COMMAND 176 STARTING: SENDING GET MESSAGE
11-16 14:11:37.977 9350-9396/? E/bt_btif: bta_gattc_cmpl_cback unknown conn_id = 4, ignore data
11-16 14:11:37.978 9668-9679/com.example.root.gotennaapp I/GTEventNotifier: GET MESSAGE - RESPONSE NEGATIVE

What is the problem here?
Thank you for your help.

1 Like

Hello WiseLudo,

From your Android logs it looks like the receiving Android app is able to pull the sent message. Are you filtering the logs by GTEventNotifier? If so could you check if there are any other Warning or Error logs that might have a different log tag?

It would also help to print a log in both onIncomingMessage(GTBaseMessageData baseMessageData) as well as onIncomingMessage(GTMessageData messageData) of the GTMessageListener. If the SDK was able to de-serialize the message into a GTBaseMessageData object then onIncomingMessage(GTBaseMessageData baseMessageData) otherwise it will fallback to onIncomingMessage(GTMessageData messageData).

Thanks

2 Likes

Hi dhan,

all other GTEventNotifier events in the log look fine and there aren’t any particular warnings I’m receiving.

The logs I’ve posted aren’t filtered on GTEventNotifier, in fact there’s a series of
11-16 14:11:37.496 9350-9396/? E/bt_btif: bta_gattc_cmpl_cback unknown conn_id = 4, ignore data
11-16 14:11:37.556 9350-9396/? E/bt_btif: bta_gattc_cmpl_cback unknown conn_id = 4, ignore data
11-16 14:11:37.617 9350-9396/? E/bt_btif: bta_gattc_cmpl_cback unknown conn_id = 4, ignore data

Is that a issue with the BLE connection with the GoTenna?

Both onIncomingMessage(GTBaseMessageData gtBaseMessageData) and onIncomingMessage(GTMessageData messageData) never trigger (I run in debug mode).

I ovverride those two methods in my MainActivity that is defined as follows:

public class MainActivity extends AppCompatActivity implements GTConnectionManager.GTConnectionListener, GTCommandCenter.GTMessageListener {

}

I just want the onIncomingMessage() to Toast the content of the message.

Am I missing something?

Thank you all!

If you google that string you’ll see it does appear to be an issue with Bluetooth and a number of pages that talk about it.

Hello aspexin,

I did my fair share of googling before posting on the forum. Yes, it looks like there is some lower level problem, but why is it happening?
Is there a lower bound on the API SDK and Android OS version to use the GoTenna SDK?
Could it be that my token expired? I really can’t find a solution to this.

Hello WiseLudo,

Could you specify which version of Android and which phones you are testing this on? Also is the issue reproducible on a different Android phone?

Thanks

1 Like

Hello dhan,

I’m using a Samsung S6 (Android 6.01, API 23) and a LG Rebel 2 (Android 6.01, API 23).
It’s still happening, onMessageReceived() keeps not triggering.

1 Like

Any update here @dhan?

Can someone working at GoTenna help me here, please?
It’s getting a bit frustrating that even the most basic APIs don’t work.

@WiseLudo @mficiencies we are releasing a new version of the SDK this week. Probably best to give that a go and see if the update resolves your issues. If not we can certainly dig deeper and see whats going on.

1 Like

@MikeR it’s pretty weird. The PubliSDK sample app works fine, so it’s not a hardware problem.
Can anyone assist me with this? Maybe MainActivity isn’t supposed to implement GTConnectionListener, GTCommandCenter.GTMessageListener (that’s what I’m doing in my app)?

I was doing the same thing on another app, but I had a Fragment that implemented GTConnectionListener, GTCommandCenter.GTMessageListener and it worked. Is it because of that?

@WiseLudo we’ll reach out over DM to see if we can maybe take a look at your code in more detail.

Also, fwiw, the updated Android SDK update is now live.

2 Likes

@WiseLudo @mficiencies Please ensure that you call GTCommandCenter.getInstance().setMessageListener( GTCommandCenter.GTMessageListener gtMessageListener); to receive the proper callbacks.

1 Like