Klein-Stein / flutter-account-manager-plugin

Account manager plugin for Flutter
MIT License
11 stars 7 forks source link

Using account manager inside a background service #12

Open Oberonc opened 2 years ago

Oberonc commented 2 years ago

I'm using the flutter package accountmanager for managing android accounts

inside the onStart method I have this line:

import 'package:accountmanager/accountmanager.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:permission_handler/permission_handler.dart';

void onStart(ServiceInstance service) async {
  bool isGranted = await Permission.contacts.isGranted;
  if (!isGranted) return;

  for (Account account in await AccountManager.getAccounts()) { // <- this line blocks forever
  }
}

Why does "AccountManager.getAccounts()" block ? how do I get/work with the accounts inside the background service ?

ghostman2013 commented 2 years ago

Hi, Oberonc! Thank you for the report, I will check what could be reason and will give you a feedback