Search code examples
androidandroid-permissionsandroid-6.0-marshmallowkryosnappydb

Android SnappyDB dangerous permissions


I'm updating app to android targetSdk = 23 and now working on permission requests. Do I need to get some some of dangerous permission for the snappyDB library (it uses kryo library inside)? I mean exactly this permissions:

READ_EXTERNAL_STORAGE
WRITE_EXTERNAL_STORAGE

Thank you!


Solution

  • The permission requirements depend on your implementation. By default SnappyDB uses the internal storage provided from the context. If you need to write to the external storage, you will need those permissions.

    Check the DBFactory.java class in the source code. https://github.com/nhachicha/SnappyDB/blob/master/library%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsnappydb%2FDBFactory.java

    No permissions call

    public static DB open(Context ctx, Kryo... kryo) throws SnappydbException {
        return open(ctx, DEFAULT_DBNAME, kryo);
    }
    

    Require Permission - if you write to an external folder

    public static DB open(String folder, String dbName, Kryo... kryo) throws SnappydbException {
        String dbFilePath = folder + File.separator + dbName;
        return new DBImpl(dbFilePath, kryo);
    }