diff --git a/examples/android/client/app/src/main/AndroidManifest.xml b/examples/android/client/app/src/main/AndroidManifest.xml index c318e56c70fc..4b2319013878 100644 --- a/examples/android/client/app/src/main/AndroidManifest.xml +++ b/examples/android/client/app/src/main/AndroidManifest.xml @@ -31,7 +31,7 @@ android:name="preloaded_fonts" android:resource="@array/preloaded_fonts" /> - diff --git a/examples/android/client/app/src/main/java/flwr/android_client/MyWorker.java b/examples/android/client/app/src/main/java/flwr/android_client/FlowerWorker.java similarity index 96% rename from examples/android/client/app/src/main/java/flwr/android_client/MyWorker.java rename to examples/android/client/app/src/main/java/flwr/android_client/FlowerWorker.java index ede924756ba3..8e0bc4347d3a 100644 --- a/examples/android/client/app/src/main/java/flwr/android_client/MyWorker.java +++ b/examples/android/client/app/src/main/java/flwr/android_client/FlowerWorker.java @@ -42,7 +42,7 @@ import androidx.work.Worker; import androidx.work.WorkerParameters; -public class MyWorker extends Worker { +public class FlowerWorker extends Worker { private ManagedChannel channel; public FlowerClient fc; @@ -73,9 +73,9 @@ public String getTime() { private static String PROGRESS = "PROGRESS"; - public MyWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { + public FlowerWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { super(context, workerParams); - MyWorker worker = this; + FlowerWorker worker = this; notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); fc = new FlowerClient(context.getApplicationContext()); @@ -162,7 +162,7 @@ public void loadData() { public CompletableFuture runGrpc() { CompletableFuture future = new CompletableFuture<>(); - MyWorker worker = this; + FlowerWorker worker = this; ExecutorService executor = Executors.newSingleThreadExecutor(); ProgressUpdater progressUpdater = new ProgressUpdater(); @@ -247,7 +247,7 @@ public void setProgress() { private static class FlowerServiceRunnable{ protected Throwable failed; - public void run(FlowerServiceStub asyncStub, MyWorker worker , CountDownLatch latch , ProgressUpdater progressUpdater , Context context) { + public void run(FlowerServiceStub asyncStub, FlowerWorker worker , CountDownLatch latch , ProgressUpdater progressUpdater , Context context) { join(asyncStub, worker , latch , progressUpdater , context); } @@ -281,7 +281,7 @@ public void writeStringToFile( Context context , String fileName, String content } } - private void join(FlowerServiceStub asyncStub, MyWorker worker, CountDownLatch latch , ProgressUpdater progressUpdater , Context context) + private void join(FlowerServiceStub asyncStub, FlowerWorker worker, CountDownLatch latch , ProgressUpdater progressUpdater , Context context) throws RuntimeException { final CountDownLatch finishLatch = new CountDownLatch(1); @@ -320,7 +320,7 @@ public void onCompleted() { } } - private void handleMessage(ServerMessage message, MyWorker worker , ProgressUpdater progressUpdater , Context context) { + private void handleMessage(ServerMessage message, FlowerWorker worker , ProgressUpdater progressUpdater , Context context) { try { ByteBuffer[] weights; diff --git a/examples/android/client/app/src/main/java/flwr/android_client/MainActivity.java b/examples/android/client/app/src/main/java/flwr/android_client/MainActivity.java index c4458391675f..cbf804140954 100644 --- a/examples/android/client/app/src/main/java/flwr/android_client/MainActivity.java +++ b/examples/android/client/app/src/main/java/flwr/android_client/MainActivity.java @@ -168,7 +168,7 @@ public void startWorker(View view) { .build(); PeriodicWorkRequest workRequest = new PeriodicWorkRequest.Builder( - MyWorker.class, 15, TimeUnit.MINUTES) + FlowerWorker.class, 15, TimeUnit.MINUTES) .setInitialDelay(0, TimeUnit.MILLISECONDS) .setInputData(new Data.Builder() .putString( "dataslice", deviceIdEditText.getText().toString() ) diff --git a/examples/android/client/app/src/main/res/values/strings.xml b/examples/android/client/app/src/main/res/values/strings.xml index dbbf38c0adc7..2fcdf7b0f1e0 100644 --- a/examples/android/client/app/src/main/res/values/strings.xml +++ b/examples/android/client/app/src/main/res/values/strings.xml @@ -3,5 +3,4 @@ 1002 Federated learning running Cancel federated learning - 123