apache / apache/cordova-plugin-network-information

New option to keep event receiver when a new URL is loaded on webview

Open
#96 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
465
Forks
339
PR merge metrics
No merged PRs in 30d

Description

# Feature Request
New option to keep event receiver when a new URL is loaded on webview

## Motivation Behind Feature
If you load a different URL on Cordova Webview, the onPause() and onDestroy() methods of NetworkManager are called in PluginManager.init() and the event receiver is removed . The event listener is not recovered with onResume() as the plugin has not the 'onload' flag set to true (if you force it on config.xml the notifications still do not work).
This behavior is problematic if your application loads several URLs during its life-cycle.

## Feature Description
A new option to customize this behavior.

## Alternatives or Workarounds
I found no workarounds without changing the plugi's source code.

Contributor guide

Open the contributing guide

Research direction

Start at PluginManager.init() and trace NetworkManager.onPause(), onDestroy(), and onResume() when a Cordova Webview loads a new URL. Review how the onload option in config.xml affects this lifecycle, then define and test an option that preserves the event receiver and restores notifications across URL loads.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript, objective-c
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.