📦 Import / Export Rules
Users who reinstall the app or switch devices currently lose all their per-app rules. Add the ability to export and import the rule set as a JSON file.
Requirements
Export
- Button in
SettingsScreen.kt: Export rules
- Serialize all
AppRule entries from Room into JSON
- Save via
ACTION_CREATE_DOCUMENT system picker
- Format suggestion:
{
"version": 1,
"exportedAt": "2026-04-15T10:00:00Z",
"rules": [
{ "packageName": "com.example", "wifiAllowed": true, "mobileAllowed": false }
]
}
Import
- Button: Import rules
- Open file via
ACTION_OPEN_DOCUMENT
- Validate JSON schema
- Confirm dialog: "This will overwrite your current rules. Continue?"
- Upsert rules into Room
- Trigger VPN tunnel rebuild
Edge Cases
- Invalid JSON → show error toast
- Missing packages (app uninstalled) → skip silently or log
- Schema version mismatch → show friendly error
Hints
- Use
kotlinx.serialization (add as dependency)
- Access repository via
SettingsViewModel
- File IO with
ActivityResultContracts.CreateDocument / OpenDocument
Medium difficulty — great for someone wanting to touch persistence, UI, and Android file APIs!
📦 Import / Export Rules
Users who reinstall the app or switch devices currently lose all their per-app rules. Add the ability to export and import the rule set as a JSON file.
Requirements
Export
SettingsScreen.kt: Export rulesAppRuleentries from Room into JSONACTION_CREATE_DOCUMENTsystem picker{ "version": 1, "exportedAt": "2026-04-15T10:00:00Z", "rules": [ { "packageName": "com.example", "wifiAllowed": true, "mobileAllowed": false } ] }Import
ACTION_OPEN_DOCUMENTEdge Cases
Hints
kotlinx.serialization(add as dependency)SettingsViewModelActivityResultContracts.CreateDocument/OpenDocumentMedium difficulty — great for someone wanting to touch persistence, UI, and Android file APIs!