Created by: theirix
Agreements
-
I have reviewed and accepted the guidelines for contributing to this project. -
I have reviewed and closely followed the Style Guide for this Android app.
Overview
Allow to import locally downloaded OCID data from cell_towers.csv.gz
Classification
-
Bugfix (non-breaking change which fixes an existing issue) -
New feature (non-breaking change which adds functionality) -
Refactor (restructuring of existing code without changing its external functionality) -
Breaking change (fix or feature that would cause existing functionality to not work as expected)
Note Also slightly refactored RealmHelper without change of functionality.
References
PR possibly fixes an issue #435 .
Related to discussion in issue #854 about cell_towers.csv .
Screenshots
- Added a new menu item "Import CellTowers Data". Choosing this menu launches a standard file chooser intent.
- A few new toasted notifications added (not shown).
Patch description
Rationale OCID allows to download a full daily dump of cell data in cell_towers.csv.gz or daily incremental data. Due to bad stability of OCID API it is useful to be able to locally import cell_towers.csv.
Proposed changes
- Added a drawer menu "Import CellTowers Data" which launches an intent to choose a CSV file or gzipped CSV file with CellTowers data.
- Async loader in ImportTask that reads a full dump and filters it locally with MCC, MNC, cell location just like RequestTask does by the API call.
- ImportTask converts data from CellTowers format (documented) to the OCID API CSV format and inserts it to the database with help of the RealmHelper.
- RealmHelper is slightly refactored to allow directly insert data without an intermediate file.
- Added a wrapper around GZIPInputStream because Android implementation of GZIPInputStream cannot read files larget than 2 GiB.
Testing Tested on Motorola XT1562, Android 6.0.1. Import from cell_towers.csv.gz fetches approx 1000 records (Moscow) from 29 millions total and took about twenty minutes on debug version. Unarchived version is much faster.