Category : android-workmanager

I am working on work manager to fetxh api data and initiate a notification in flutter, //this is the name given to the background fetch const simplePeriodicTask = "simplePeriodicTask"; Workmanager workmanager = Workmanager(); // flutter local notification setup Future initializeWorkManagerAndPushNotification() async { await workmanager.initialize( callbackDispatcher, isInDebugMode: false, ); //to true if still in testing lev ..

Read more

I’m struggling to understand how to use the WorkManager ListenableWorker for an async task. Let’s say my code is like this: public ListenableFuture<Result> startWork() { Object.addOnSuccessListener (response -> { apiClient.makeSomeAPICall(data); } return Result.success(); } But all this results in is a Retrofit error E/AndroidRuntime: FATAL EXCEPTION: main Process: com.app.android, PID: 23334 retrofit.RetrofitError … at $Proxy0.makeSomeAPICall(Unknown ..

Read more

I’m struggling to understand how to utilize ListenableWorker for an asynchronous task. In my instance I have some code that looks like this in my doWork() method (which I believe should be startWork() for a ListenableWorker): public Result doWork(){ Map<String, Integer> dateStepsMap = new HashMap<>(); Fitness.getHistoryClient(context, googleSignInAccount) .readData(FitnessTrackingUtils.getQueryFitnessDataRequest()) .addOnSuccessListener (response -> { // a bunch ..

Read more

I’m trying to do according to the documentation, but the WorkManager crashes even before the doWork method manifest <provider android:name="androidx.work.impl.WorkManagerInitializer" android:authorities="${applicationId}.workmanager-init" tools:node="remove" /> application @HiltAndroidApp class MonitoringApp : Application(), Configuration.Provider { @Inject lateinit var workerFactory: HiltWorkerFactory override fun getWorkManagerConfiguration(): Configuration { return Configuration.Builder() .setWorkerFactory(workerFactory) .build() } } worker @HiltWorker class UploaderWorker @AssistedInject constructor( @Assisted appContext: ..

Read more

I’m following the documentation, but the WorkManager crashes even before the doWork method manifest <provider android:name="androidx.work.impl.WorkManagerInitializer" android:authorities="${applicationId}.workmanager-init" tools:node="remove" /> application @HiltAndroidApp class MonitoringApp : Application(), Configuration.Provider { @Inject lateinit var workerFactory: HiltWorkerFactory override fun getWorkManagerConfiguration(): Configuration { return Configuration.Builder() .setWorkerFactory(workerFactory) .build() } } worker @HiltWorker class UploaderWorker @AssistedInject constructor( @Assisted appContext: Context, @Assisted workerParams: WorkerParameters, ..

Read more