Android Question Database is not creating on mobile device.Is some setting/permission required.

Juzer Hussain

Active Member
Licensed User
If File.Exists(File.DirInternal, "gulf.db") = False Then
ProgressDialogShow("New User Found, Importing Data, Please Wait........")
Sql2.Initialize(File.DirInternal, "gulf.db", True)
'and create it
CreateDataBase

'and copy data from Server
DownLoadData
end if

Pls guide me.
 

edgar_ortiz

Active Member
Licensed User
Hey Juzer,
IF :
If File.Exists(File.DirInternal, "gulf.db") = False

That's mean that NOT exists "gulf.db" and you CAN'T "Sql2.Initialize(File.DirInternal, "gulf.db", True)" because "gulf.db" does not exists.

I "figure" what you want to do... You can try:
- Include in your project a "gulf.jpg"
- If File.Exists(File.DirInternal, "gulf.db") = False THEN Copy "gulf.jpg" to "gulf.db"

Regards,

Edgar
 

mangojack

Well-Known Member
Licensed User
B4X:
Sql2.Initialize(File.DirInternal, "gulf.db", True)
Does not the paramater "True" mean .. create database file if it does not exist .. ?

Include in your project a "gulf.jpg"
- If File.Exists(File.DirInternal, "gulf.db") = False THEN Copy "gulf.jpg" to "gulf.db"
Why .jpg .. ? Why not include gulf.db and then copy to Dir.Internal if not exists ..?
 
Last edited:

Juzer Hussain

Active Member
Licensed User
Hi edgar_ortiz and mango jack,

Thanks for your replies.It seems like the db is getting created but the data is not downloading.Can you think of any reason.

Juzer
 

Juzer Hussain

Active Member
Licensed User
It shows "New user found......" waits for few seconds but does not copy data from server.
DB is empty.
It is downloading data in emulator.Is there any consideration in mobile Device like permission to be set etc.

Pls guide me.
 

Juzer Hussain

Active Member
Licensed User
Its ok now. Actually HttpJob takes time finishing and while it is still running program execution moves to next statement.Later when HttpJob has finished code will execute again from next statement onwards.I removed functions which called HttpJob(DownLoadData) and put them sequentially in main function it solved the problem.
 
Top