Android - Firebase FCM and Android Studio Emulators, intermittent behaviour - android

I'm not yet entirely sure why but it seems that when I use the Firebase FCM services and have 2 or more emulators running on my Android Studio the Firebase FCM API behaviour goes nuts.
The Flow
A quick example is:
1 - I subscribe to a topic
FirebaseMessaging.getInstance().subscribeToTopic(topicName).addOnCompleteListener...
2 - Send messages (All good so far, I get all messages)
3 - Unsubscribe FirebaseMessaging.getInstance().unsubscribeFromTopic(topicName).addOnCompleteListener...
4 - Send messages (all good so far, I don't get messages anymore)
The problem:
When I repeat the same thing with two or more devices, it simply does not work, even though I get the response of the addOnCompleteListener method, let's say "unsubscribed", I still get messages.
Points to notice:
1 - Yes, I'm sure I unsubscribe only 1 device between the two, and the one I unsubscribe keeps getting messages (I can see in the log files).
2 - No, the problem does not happen when I use one emulator only
3 - I've already tried to use a real device via debug mode (connected via USB cable and I still have the same behaviour when running in parallel with another emulator)
4 - Yes, I'm sure I get the response from the FirebaseMessaging.getInstance().unsubscribeFromTopic(topicName) method before sending messages.
Specs:
Android Studio: 3.1.2
Firebase:
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
My assumption
There's something broken between the identification of more than one emulator when it's run in parallel, and therefore the Firebase topics API cannot distinguish accurately which is which.
Any thoughts?
Cheers in advance.

Related

Failed to publish the request over MQTT - Flutter - Parse Server

I have a sample app that uses Parse Server. I've been testing my app on both emulator and physical devices and I noticed that the response time is much slower on the physical device.
This one is from the emulator.
and this is one is from the physical device:
I've been scratching my head regarding this one. I've also posted it on the parse community platform and followed the advice there to manually monitor the server for every change I've made until I reach my prior server configuration. I overhauled the server from scratch. Do some load testing -> Deployed the server on a replica set -> load testing. Now, I'm in the process of doing some basic queries. I used ADB logcat to see what's happening on both device and saw these errors on the physical device and not on the emulator:
E[N rtchannel]_rt_mqtt_publish_callback(356)=>Failed to publish the request over MQTT. token:be925eea-407c-417d-96c9-3af5a7e83e48, category:mcd-sync-data-task-category, requestId:54138, error:Error Domain=mqtt Code=3008
E[S sync]_createResponseError(166)=>Network Response be925eea-407c-417d-96c9-3af5a7e83e48 contains sync error Error Domain=mqtt Code=3008 - Underlying error (null): Error Domain=mqtt Code=3008
This one also shows before pulling the payload.
W[S sync-state-machine]MCDSyncStateMachineScheduleDelayedRetry(173)=>skipping the new retry with longer delay
W[S sync]_scheduleNextCursorRetry(326)=>skipping delayed retry due to state machine state decision
The number of times these errors pop up is related to the number of queries executed. I did not put any configurations on the server which use MQTT. Any help is much appreciated.

Movesense - Sensor disconnects after 35 seconds

We have developed an application with Movesense. The application connects and subscribes to the Accelerometers.
It is running for 35 seconds and receives data from the sensor.
Each time after 35 seconds the sensor stops sending data (Not sending onNotification(String data)) and after a few more seconds disconnects. Few more seconds later it reconnects and continues to send data.
This totally ruins the user experience and the ability to work with Movesense.
We have tried 4 different Movesense sensors. The problem exists in all.
Also we updated firmware to all our sensors, but the problem did not go away.
In the Device Documentation in the file "Changes.md" we found the following 2 lines:
"Known Bugs:"
"HR stops sending data after Acc/Magn/Gyro subscription"
Reading trough most of the device-lib documentation, and the issues in Stuck-overflow (i.e. here) we were not able to find any further documentation about this issue.
We have a few obvious questions:
1. Is what we see is the "Known Bug"?
2. If yes, is there any further documentation on it?
3. If yes, is there a known workaround for it?
4. If no, what would you recommend to do?
Thanks,
Eric.
Update: After testing with mobile devices with API 23 or higher the problem disappeared. The original mobile device was API 22. Also, since we don't have another device with API 22 or lower, we cannot rule-out that the API 22 device has some issue in its Bluetooth which may not be related to the API.
I am leaving this question unanswered since we would still like to ask how or where to find more details about the known bug “HR stops sending data after Acc/Magn/Gyro subscription” described by this sentence in the Movesense Device Lib documentation.
Thanks,
Eric.

EML327 not responding after 15-20 minutes

I have implemented successfully the pires/obd-java-api OBD Interface in an Android app and everything works as expected, expect that after about 1.000 - 1.500 API calls, the API stops responding.
Did anyone come across the same problem?
Is it maybe necessary to send a reset command to the OBD dongle after some time?
I thought it might be that the API is collecting data and a memory problem occurs, but onTrimMemory is never called.
I assume API means Standard Pids(mode 1)then OBD will not response in following case
1: TimeoutCommand is too low, set 255
2: may be not proper power supply
Note: ResetCommand is used as initial command once before fetching real time data.
you can refer android-obd-reader sample app:
https://github.com/md-sohrab-alam/android-obd-reader

Google Cloud Messaging: Unable to register to subscribe to certain topics - exception=java.io.IOException: INVALID_PARAMETERS

I've got a weird situation. I've got 3 devices that i registered at GCM.
Two 4.x devices and one 6.0.1.
I'm trying to subscribe my devices to two topic "channels" - "global" & "defaultchannel" - via the subscribeTopics() method in the same way as it's done in google's example app: here
My 4.x devices have no issue registering to both topics but my 6.0 device is simple not able to register anywhere else besides the "global" channel.
When the device tries to register at "global" everything goes well, but then when it tries to register at the other channel it always keeps throwing an IOException:
Failed to complete token refresh: exception=java.io.IOException: INVALID_PARAMETERS
Next to this exception also show me this message on the 6.0 device which is not logged on the other (working) devices:
W/InstanceID/Rpc: Found 10008
This makes no sense at all to me. Does anyone know how to handle this issue?

Cannot set temperature interval on sensortag

I'm creating an android application that interfaces with the texas instruments sensortag. One of the things the app needs to do is be able to change the frequency in which the temperature is reported to the app. I am able to change it through the official TI app which is great, but I cannot seem to get it working in my app.
When viewing the official app (iOS, can't run the android one?), it shows the temperature GATT service, which contains 3 characteristics. When I inspect the characteristics discovered by my app however, it only seems to find two - the data, and the notifications. Not the interval. I have attempted to construct this characteristic myself and write it however it doesn't do anything - no error, no success, just nothing.
The steps I've taken are essentially:
bluetoothGatt.discoverServices();
...
services = bluetoothGatt.getServices();
...
BluetoothGattService service = bluetoothGatt.getService(serviceUUID);
System.out.println("Characteristic = " + service.getCharacteristic(SensorTagGatt.UUID_IRT_PERI));
The output yields null. Is there something obvious I'm missing or that I should be doing that I might not be?
EDIT:
I've installed another app onto the phone written by another developer, and using this to inspect the services and characteristics available shows that it too is unable to find it, so I'm assuming there is something wrong with the android service discovery? The official iOS app is working as expected, and showing all characteristics. Unfortunately, the official android app seems to be incompatible with the version 1.5 firmware and crashes when trying to connect but I assume it too will fail to find the characteristic.
Has anyone else run into this issue and if so been able to get around it?

Categories

Resources