Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Flower Android Version #2429

Merged
merged 22 commits into from
Oct 16, 2023
Merged

Update Flower Android Version #2429

merged 22 commits into from
Oct 16, 2023

Conversation

Shaz-hash
Copy link
Contributor

Description

In this contribution we have created an updated version of Android Example that will launch a reliable and persistent background thread to allow devices to contribute to federated learning(FL) for longer periods of time.

Unlike pervious android example which required the app to be on foreground and on display, this version is free from all these limitations (thread will execute even when app is removed from background task tray or when device is in sleep mode).

This background thread is established via WorkManager library of Android thus will run comfortably on Android Versions from 8 to 13.

Added Features

  • Safe and Reliable FL process in a background thread
  • Persistent Restart Mechanism (will ensure FL process restarts incase device reboots, thread is killed from internet dis connectivity or the unavailablity server communiction)
  • Added Foreground Service Notification for the transparency on when the FL process is running
  • Added Recycler View & Message Adapter to display the updates with scrolling feature
  • Added Start/Stop buttons to allow users to cancel the background thread whenever they want.
  • Added Battery Optimisation Permission incase user wants to ensure that FL thread is given sufficient resources when device is in doze(sleep) mode
  • Added File read/write access Permission to allow FL thread to add the updates in its respective directory
  • Added Refresh/Clear Buttons to update the list shown over recycler view

Note

  • Some Android Vendors(e.g. Huawei) have their own restrictions over the execution of background threads which may not allow resources allocated to the thread even when battery optimisation is disabled for Flower.
  • Android 14 will allow the background thread to execute but the foreground notification service will not be visible.

Shaz-hash and others added 4 commits September 27, 2023 20:59
Added WorkManager library to allow the FL process to run in the background.
Updated protobuf gradle files and added dependency on workManager
@Shaz-hash Shaz-hash mentioned this pull request Sep 28, 2023
@danielnugraha
Copy link
Contributor

Thanks for creating the pull request, looks good to me! The added feature code looks clean and the android manifest is also updated accordingly.

1 small change request: Can you update the readme to include this info regarding background task?
"This background thread is established via WorkManager library of Android thus will run comfortably on Android Versions from 8 to 13."

examples/android/README.md Outdated Show resolved Hide resolved
examples/android/README.md Outdated Show resolved Hide resolved
@danieljanes
Copy link
Member

Thanks for the PR @Shaz-hash, this is a great update. I resolved all of the trivial suggestions, there are now only two comments left to be resolved.

Shaz-hash and others added 3 commits October 14, 2023 15:53
-Removed unnecessary string variable
-Renamed MyWorker to FlowerWorker
@danieljanes danieljanes enabled auto-merge (squash) October 16, 2023 15:04
@danieljanes danieljanes merged commit e8223fd into adap:main Oct 16, 2023
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants