Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. App Crash When Interacting During Data Reading.

App crash when interacting during data reading.

By saraf_kshitiz , 21 February, 2025
Forums
Gurux DLMS for Android

Hello Mikko Sir,

The app crashes or freezes when user taps on the screen while data is being fetched from the meter.
I've set a loading overlay screen which prevents any click event on the screen.
The loading overlay appears when reading data from the meter, still, the app crashes and "App isn't responding" popup appears when I accidently touch the screen during data reading.
Although the data fetching process is of some seconds only, yet it is a major blocker in the development of the app.
How do I prevent this thing from happening? Please guide, sir.

Thanks,
Kshitiz

saraf_kshitiz

1 year 3 months ago

Hello Mikko Sir, I am…

Hello Mikko Sir,

I am expecting a response on the above issue. 

Also, why there's this type of error in the logcat everytime interacting with the meter :-

2025-02-25 16:10:56.388  5489-6453  MIUIScout App           gurux.dlms.android                   W  Event:APP_SCOUT_WARNING Thread:main backtrace: (Ask Gemini)
                                                                                                        at java.lang.Object.wait(Native Method)
                                                                                                        at java.lang.Object.wait(Object.java:405)
                                                                                                        at gurux.common.AutoResetEvent.waitOne(AutoResetEvent.java:94)
                                                                                                        at gurux.common.GXSynchronousMediaBase.findData(GXSynchronousMediaBase.java:378)
                                                                                                        at gurux.common.GXSynchronousMediaBase.receive(GXSynchronousMediaBase.java:460)
                                                                                                        at gurux.serial.GXSerial.receive(GXSerial.java:1077)
                                                                                                        at gurux.dlms.android.connection.DeviceConnection.readDLMSPacket(DeviceConnection.java:640)
                                                                                                        at gurux.dlms.android.connection.DeviceConnection.readDataBlock(DeviceConnection.java:351)
                                                                                                        at gurux.dlms.android.connection.DeviceConnection.readDataBlock(DeviceConnection.java:332)
                                                                                                        at gurux.dlms.android.connection.DeviceConnection.refresh(DeviceConnection.java:152)
                                                                                                        at gurux.dlms.android.activities.MainActivity.lambda$onCreate$4$gurux-dlms-android-activities-MainActivity(MainActivity.java:256)
                                                                                                        at gurux.dlms.android.activities.MainActivity$$ExternalSyntheticLambda4.run(D8$$SyntheticClass:0)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:222)
                                                                                                        at android.os.Looper.loop(Looper.java:314)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8680)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
2025-02-25 16:10:58.884  5489-5503  MIUIScout App           gurux.dlms.android                   W  Enter APP_SCOUT_HANG state
2025-02-25 16:10:58.884  5489-5503  MIUIScout App           gurux.dlms.android                   W   (Current message: duration=5248ms seq=3635 late=8ms h=android.os.Handler c=gurux.dlms.android.activities.MainActivity$$ExternalSyntheticLambda4)
2025-02-25 16:10:58.894  5489-5503  AppScoutStateMachine    gurux.dlms.android                   D  dump trace dirName = 2025-02-25-16-10-58-5489-APP_SCOUT_HANG-gurux.dlms.android
2025-02-25 16:10:58.897  5489-6455  MIUIScout App           gurux.dlms.android                   W  Event:APP_SCOUT_HANG Thread:main backtrace: (Ask Gemini)
                                                                                                        at java.lang.Object.wait(Native Method)
                                                                                                        at java.lang.Object.wait(Object.java:405)
                                                                                                        at gurux.common.AutoResetEvent.waitOne(AutoResetEvent.java:94)
                                                                                                        at gurux.common.GXSynchronousMediaBase.findData(GXSynchronousMediaBase.java:378)
                                                                                                        at gurux.common.GXSynchronousMediaBase.receive(GXSynchronousMediaBase.java:460)
                                                                                                        at gurux.serial.GXSerial.receive(GXSerial.java:1077)
                                                                                                        at gurux.dlms.android.connection.DeviceConnection.readDLMSPacket(DeviceConnection.java:640)
                                                                                                        at gurux.dlms.android.connection.DeviceConnection.readDataBlock(DeviceConnection.java:351)
                                                                                                        at gurux.dlms.android.connection.DeviceConnection.readDataBlock(DeviceConnection.java:332)
                                                                                                        at gurux.dlms.android.connection.DeviceConnection.refresh(DeviceConnection.java:152)
                                                                                                        at gurux.dlms.android.activities.MainActivity.lambda$onCreate$4$gurux-dlms-android-activities-MainActivity(MainActivity.java:256)
                                                                                                        at gurux.dlms.android.activities.MainActivity$$ExternalSyntheticLambda4.run(D8$$SyntheticClass:0)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:222)
                                                                                                        at android.os.Looper.loop(Looper.java:314)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8680)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)

Does the gurux serial library code blocks the UI thread in android while execution? 
If so, how can I deal with it? 
Please note: I am already executing the gurux code functions using :- 

/**
* Execute the code in separate thread for avoiding blockage of UI thread.
* @param task the runnable to be executed in the new thread.
*/
public static void execute(Runnable task) {
Executors.newSingleThreadExecutor().execute(() -> handler.post(task));
}

Please guide. 

Thanks, 
Kshitiz

Profile picture for user Kurumi

Kurumi

1 year 3 months ago

Hi Kshitiz, You need to…

Hi Kshitiz,

You need to check that you are not pausing the application when you read data from the meter.
The problem with meter reading it that you need to read all data before closing the connection to the meter when the application is closed or paused and this might take time.

Some meters stop responding if the connection is not properly closed and you need to wait until inactivity time has elapsed before reconnecting.

BR,
Mikko

saraf_kshitiz

1 year 3 months ago

Hello Sir, I'll keep that…

Hello Sir,

I'll keep that in mind.

Thanks,
Kshitiz

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin