welu1805 Active Member Licensed User Longtime User Jan 26, 2019 #1 Hi all, I have 2 apps (e.g. A and B). In File.DirDefaultExternal of app A is a SQLite database with the table "texte". From app B I want to open the database from app A and read the table "texte". Is this possible? In my example in app B I get the error "not found" but with File.Exists I see that path and filename are correct. Has anyone an idea? Thanks Lutz
Hi all, I have 2 apps (e.g. A and B). In File.DirDefaultExternal of app A is a SQLite database with the table "texte". From app B I want to open the database from app A and read the table "texte". Is this possible? In my example in app B I get the error "not found" but with File.Exists I see that path and filename are correct. Has anyone an idea? Thanks Lutz
DonManfred Expert Licensed User Longtime User Jan 26, 2019 #2 App B does not have the rights to access files from App A. thats the primary point. It is not possible. Store the Database on a Path accessible by both. Also note that you should NOT access the database from two apps at the same time. One app in foreground and the other app in background using a service or so. Sqlite is not able to handle this. Or better; use a jRDC as Database middleware and access the data from both apps from this Database. In Android you would need to create an ContentProvider in App A and Access this content from App B. But there is no Library to do so at this time i think. Or i do not remember having seen one. In my wrap for the Whatsappstticker is a ContentProvider working. But it is one specific to some known files in the filesfolder (static files in this case). If you are interested in reading more about it. Creating a content Provider. Last edited: Jan 26, 2019 Upvote 0
App B does not have the rights to access files from App A. thats the primary point. It is not possible. Store the Database on a Path accessible by both. Also note that you should NOT access the database from two apps at the same time. One app in foreground and the other app in background using a service or so. Sqlite is not able to handle this. Or better; use a jRDC as Database middleware and access the data from both apps from this Database. In Android you would need to create an ContentProvider in App A and Access this content from App B. But there is no Library to do so at this time i think. Or i do not remember having seen one. In my wrap for the Whatsappstticker is a ContentProvider working. But it is one specific to some known files in the filesfolder (static files in this case). If you are interested in reading more about it. Creating a content Provider.
DonManfred Expert Licensed User Longtime User Jan 26, 2019 #3 You also can just share data from one app to another. See this tutorial https://www.b4x.com/android/forum/threads/tutorial-inter-app-communication-with-intents.30608/ But this is not using a Database at all. It just shows a way to transport Data. also useful reading: https://developer.android.com/training/sharing/ Upvote 0
You also can just share data from one app to another. See this tutorial https://www.b4x.com/android/forum/threads/tutorial-inter-app-communication-with-intents.30608/ But this is not using a Database at all. It just shows a way to transport Data. also useful reading: https://developer.android.com/training/sharing/
Erel B4X founder Staff member Licensed User Longtime User Jan 27, 2019 #4 Don't use File.DirDefaultExternal. Use RuntimePermissions.GetSafeDirDefaultExternal instead (same path but doesn't require permission*). This path can be accessed by other apps. They just need to request the write external storage. You can use it to share the database. The path is specific to each app so you will need to use the path string (Log(File.DirDefaultExternal)). * - See runtime permissions tutorial Upvote 0
Don't use File.DirDefaultExternal. Use RuntimePermissions.GetSafeDirDefaultExternal instead (same path but doesn't require permission*). This path can be accessed by other apps. They just need to request the write external storage. You can use it to share the database. The path is specific to each app so you will need to use the path string (Log(File.DirDefaultExternal)). * - See runtime permissions tutorial
DonManfred Expert Licensed User Longtime User Jan 27, 2019 #5 welu1805 said: Is this possible? Click to expand... Check this Thread https://www.b4x.com/android/forum/threads/playground-contentprovider-simple.101967/ Upvote 0
welu1805 said: Is this possible? Click to expand... Check this Thread https://www.b4x.com/android/forum/threads/playground-contentprovider-simple.101967/