apache / apache/cordova-android

Restore selected files when Activity restores after being killed

Open
#1,536 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.8k
Forks
1.6k
Avg merge
16h 18m
Merged PRs (30d)
11

Description

# Feature Request

## Motivation Behind Feature

Currently, if you select file(s) via the `` element and the system decides to kill the Activity, the selected files will not be reachable when the `Activity` restores. The problem can be reproduced by enabling `Android > Settings > Developer Options > Don't keep activities`.

## Feature Description

A new `CordovaPlugin` is needed, which correctly returns the selected files with Cordova's `resume` event. `CordovaPlugin` at:

[SystemWebChromeClient.java#L231-L253](https://github.com/apache/cordova-android/blob/d02f8eafe8e34e33971c2e6dad2449cf1655ac99/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java#L231-L253)

...needs to be replaced with this new `CordovaPlugin`.

## Alternatives or Workarounds

I created a new Cordova plugin to solve this problem. See it here:

[https://github.com/tunnela/cordova-plugin-pending-files](https://github.com/tunnela/cordova-plugin-pending-files)

However, the implementation is not optimal, as I had to create a new class that extends the `SystemWebChromeClient` class of the `cordova-android` package and which is set as the new `WebChromeClient` when the my plugin is initialized. This may cause unexpected behavior. Therefore the new `CordovaPlugin` should be part of the `cordova-android`.

Contributor guide

Open the contributing guide

Research direction

Start with framework/src/org/apache/cordova/engine/SystemWebChromeClient.java at lines 231-253, then compare the referenced cordova-plugin-pending-files implementation. Trace how selected files should reach Cordova's resume event after Activity restoration; done means those files remain available when the Activity is recreated.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.