zubairehman/Flogs

Cannot log when app is in background.

rod5438 opened this issue · 1 comments

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);
  }

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