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

Cannot log when app is in background. #66

Open
rod5438 opened this issue Aug 3, 2021 · 1 comment
Open

Cannot log when app is in background. #66

rod5438 opened this issue Aug 3, 2021 · 1 comment

Comments

@rod5438
Copy link

rod5438 commented Aug 3, 2021

I use flutter WorkManager to trigger background task.
However, Flogs not work anymore.

  Future _openDatabase() async {
    // Get a platform-specific directory where persistent app data can be stored
    final appDocumentDir = await getApplicationDocumentsDirectory();

    // Path with the form: /platform-specific-directory/demo.db
    final dbPath = join(appDocumentDir.path, DBConstants.DB_NAME);

    // Check to see if encryption is set, then provide codec
    // else init normal db with path
    var database;
    if (FLog.getDefaultConfigurations().encryptionEnabled &&
        FLog.getDefaultConfigurations().encryptionKey.isNotEmpty) {
      // Initialize the encryption codec with a user password
      var codec = getXXTeaSembastCodec(
          password: FLog.getDefaultConfigurations().encryptionKey);

      database = await databaseFactoryIo.openDatabase(dbPath, codec: codec);
    } else {
      database = await databaseFactoryIo.openDatabase(dbPath); // <====== not return in the background
    }

    // Any code awaiting the Completer's future will now start executing
    _dbOpenCompleter!.complete(database);
  }
@MohamedRisaldarTA
Copy link

Hi,
Do we have any updates on this.
I am also facing this issue.

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

No branches or pull requests

2 participants