Search code examples
androidiossqliteionic-frameworkcapacitor-plugin

Unable to find GlobalSQLite file for capacitor-community/sqlite in Ionic 5


In my Ionic 5 app, I am using the capacitor-community/sqlite plugin. I am successfully able to create and use an encrypted db with this plugin. To use encryption a secret is required and the following is maintained in the official documentation as of today.

Defining your own secret and newsecret keys (encryption only)

  • in IOS, go to the Pod/Development Pods/capacitor-sqlite/GlobalSQLite.swift file
  • in Android, go to capacitor-sqlite/java/com.jeep.plugin.capacitor/cdssUtils/GlobalSQLite.java and update the default values before building your app.
  • in Electron, go to YOUR_APP/electron/plugins/plugin.js-xxxx.js and search for class GlobalSQLite and modify the this.secretand
    this.newsecret parameters.

I have searched for files GlobalSQLite.swift and GlobalSQLite.java in IOS and android respectively but there are no such files present. Also, the file paths are not available. I am not sure how to get these files to set my secret in the app. Please help.


Solution

  • You should look for the GlobalSQLite.java in node_modules\@capacitor-community\sqlite\android\src\main\java\com\getcapacitor\community\database\sqlite\SQLite. After changing the secrets you may need to sync the platforms with ionic cap sync.

    The iOS and Electron files you also find there