Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR splits the Android application into two variants, using the flavour mechanism of Android:
google
variant, with support for FCM notifications for just-in-time payments and background processing. It embeds some Google Play Services libraries.foss
variant without any of the Google Play Services libraries, that is, without the FCM notifications.The rest of the application is the same between the two variants.
Why make a non-google variant
It allows us to:
Background processing without FCM
To receive payments Phoenix must be online. To make it possible for payments to be received even if the app is not running (which is the case most of the time for an app on a mobile device), we have been using FCM notifications.
This will still be the case on the
google
variant.However the
foss
variant cannot use FCM. The alternative is to let Phoenix run in the background all the time, using a "foreground" service (i.e., you'll get a permanent notification for Phoenix in the Foreground Tasks Manager). This is similar to what Simplex is doing for chat messages.Experimental feature
A new button has been added in Settings > Experimental features. Starting the service must be initiated manually by the user. If the service is not started then the app will behave normally, except that it won't be able to receive payments when the app is closed or in the background (depending on the Android version).
Impact on battery
Due to the Doze/Stand-by mode optimisations, this background mode needs to acquire a partial wake-lock when started, so that the service is not eagerly killed by Android. This has a significant impact on battery usage.
How reliable is it
Tests look good, and payments are faster than with FCM. However it remains to be seen whether it's reliable enough on a vast array of devices to be worth the battery cost. If not, we'll need to reassess.
It's also possible that, in the longer term, the permanent foreground service solution is restricted on Android altogether.