Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Network plugin handleOnResume throws ANR

Open
#2,563 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
java

Research direction

Start in network/android/src/main/java/com/capacitorjs/plugins/network/NetworkPlugin.java at handleOnResume and inspect Network.getNetworkStatus, especially the ConnectivityManager call shown in the ANR trace. Check how this plugin or repository dispatches background work before choosing an execution path. Done means resume handling no longer blocks the main thread while preserving the network-status behavior.

Written by the indexing model from the issue text.

Description

triage

The network plugin's handleOnResume calls getNetworkStatus from main thread, which can be a slow operation:
https://github.com/ionic-team/capacitor-plugins/blob/2be8127d580a847c832698169893079b3960b9f3/network/android/src/main/java/com/capacitorjs/plugins/network/NetworkPlugin.java#L60

I've seen a crashlytics report of an ANR thrown because of this:

android.os.BinderProxy.transactNative (Native method)
This Binder call may be taking too long, causing the main thread to wait, and triggering the ANR.
android.os.BinderProxy.transact (BinderProxy.java:659)
android.net.IConnectivityManager$Stub$Proxy.getActiveNetwork (IConnectivityManager.java:1798)
android.net.ConnectivityManager.getActiveNetwork (ConnectivityManager.java:1549)
com.capacitorjs.plugins.network.Network.getNetworkStatus (Network.java:77)
com.capacitorjs.plugins.network.NetworkPlugin.handleOnResume (NetworkPlugin.java:60)
com.getcapacitor.Bridge.onResume (Bridge.java:1347)
com.getcapacitor.BridgeActivity.onResume (BridgeActivity.java:98)
android.app.Instrumentation.callActivityOnResume (Instrumentation.java:1490)
android.app.Activity.performResume (Activity.java:8281)
android.app.ActivityThread.performResumeActivity (ActivityThread.java:4960)
android.app.ActivityThread.handleResumeActivity (ActivityThread.java:5018)
android.app.servertransaction.ResumeActivityItem.execute (ResumeActivityItem.java:60)
android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:2374)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loopOnce (Looper.java:233)
android.os.Looper.loop (Looper.java:344)
android.app.ActivityThread.main (ActivityThread.java:8249)
java.lang.reflect.Method.invoke (Native method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:589)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1071)

Perhaps this call should make from a background thread like this?

@Override
public void handleOnResume() {
    super.handleOnResume();
    
    // Dispatch heavy operations off the Main thread
    CapacitorJS.getEngine().executeOnBackgroundThread(() -> {
        // Your background work here
    });
}
``
Dominant language
Java
Stars
682
Forks
689
Avg merge
5d 11h
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ionic-team/capacitor-plugins

All issues in ionic-team/capacitor-plugins

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.