Hi to all!
I develop a new app that use some routine extract from another project developped with B4A v. 6.8, and other version ok SDK.
In particolar, all routines that save data (SQLite database, for example) in Dir.DefaultExternal.
I'm developing this new app with B4A v. 9.50 and android.jar v. 28, jdk1.8.0_201.
I did read some post, where was explain whats to put on manifest editor, and I added this:
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_MEDIA_STORAGE)
AddPermission(android.permission.READ_MEDIA_STORAGE)
On starting, I had log this:
File.ExternalWritable = true
File.DirDefaultExternal= /storage/emulated/0/Android/data/{PackageName}/files
File.DirRootExternal= /storage/emulated/0
File.DirInternal= /data/user/0/{PackageName}/files
During initializing of SQLite database, with this code:
DBLocalTemporary.Initialize(dbLocalPath, dbLocalName, FlagCreateLocalDB)
I obtain:
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
If I change Dir.DefaultExternal in File.DirInternal it's all ok.
With this setting, update APK don't works.
I download new APK's file with FTP library and process ended normally.
I check existence of new APK's file on File.DirInternal directory, but when try to install with intent with this code:
Dim ii As Intent
ii.Initialize(ii.ACTION_VIEW, "file://" & apkNew)
ii.SetType("application/vnd.android.package-archive")
StartActivity(ii)
App crash and on log I found this:
android.os.FileUriExposedException: file:///data/user/0/etp.pushexample/files/VerifierAlarmsSafeCash.apk exposed beyond app through Intent.getData()
My questions are:
1) why in other version with same devices Dir.DefaultExternal was ok?
2) why I can't found File.DirDefaultExternal= /storage/emulated/0/Android/data/{PackageName}/files on my device?
3) why I can't install new version with intent?
Can you help me?
Thanks in advance for all tips...
Matteo
I develop a new app that use some routine extract from another project developped with B4A v. 6.8, and other version ok SDK.
In particolar, all routines that save data (SQLite database, for example) in Dir.DefaultExternal.
I'm developing this new app with B4A v. 9.50 and android.jar v. 28, jdk1.8.0_201.
I did read some post, where was explain whats to put on manifest editor, and I added this:
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_MEDIA_STORAGE)
AddPermission(android.permission.READ_MEDIA_STORAGE)
On starting, I had log this:
File.ExternalWritable = true
File.DirDefaultExternal= /storage/emulated/0/Android/data/{PackageName}/files
File.DirRootExternal= /storage/emulated/0
File.DirInternal= /data/user/0/{PackageName}/files
During initializing of SQLite database, with this code:
DBLocalTemporary.Initialize(dbLocalPath, dbLocalName, FlagCreateLocalDB)
I obtain:
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
If I change Dir.DefaultExternal in File.DirInternal it's all ok.
With this setting, update APK don't works.
I download new APK's file with FTP library and process ended normally.
I check existence of new APK's file on File.DirInternal directory, but when try to install with intent with this code:
Dim ii As Intent
ii.Initialize(ii.ACTION_VIEW, "file://" & apkNew)
ii.SetType("application/vnd.android.package-archive")
StartActivity(ii)
App crash and on log I found this:
android.os.FileUriExposedException: file:///data/user/0/etp.pushexample/files/VerifierAlarmsSafeCash.apk exposed beyond app through Intent.getData()
My questions are:
1) why in other version with same devices Dir.DefaultExternal was ok?
2) why I can't found File.DirDefaultExternal= /storage/emulated/0/Android/data/{PackageName}/files on my device?
3) why I can't install new version with intent?
Can you help me?
Thanks in advance for all tips...
Matteo