2
I have the following dilemma:
I’m setting up an app where I perform a synchronization between a Mysqle database and Sqlite using a Webservice.
My database is already available in Mysql, and in my app during my splash screen I need to make a check: If there is any database already synchronized in the system the user is redirected to the login screen. If not, it should be redirected to the screen where it should inform the data to perform synchronization.
If it was a check in a table I would have to enter the name of the database for my Sqliteopenhelper and so perform the operation on a given table, but how do I do this in the database itself?
But does this check if the database(file .sqlite) exists? Type, if the application is starting for the first time?
– user28595
If you have never called the method where creates the table (and therefore the file) this method will return false (because there is no such BD yet), otherwise it will return true.
– Luiz
The best solution would be to show the login screen with an option below written sign up.
– Luiz
So this method should be added to the auxiliary class of the bank (which extends Sqliteopenhelper) right? P.S.: I’m not the one who asked, just curious, even hehe
– user28595
Yes, only after I saw that it was not the same of the question. Haha. This method can be in any class. In my projects it usually stays in a Dbhelper or Dbutils class, along with other database utility methods.
– Luiz
+1 for the clarification. Just a hint, it would be interesting to add these clarifications in the answer too, so it gets even clearer and complete, and more passive to be positive by other colleagues :)
– user28595
Okay, obg. Done! :)
– Luiz
Great answer Luiz, but in my case it won’t work. Let me explain: In my case, the name of each database would be defined by a different token related to each company registered in the app, so before performing a first synchronization I would not have to inform the name of the database to use with your method, but still thank you very much for the reply.
– Rafael