Using SQLite on Android (plugins or permissions) ?

I have my app working find on iOS and on the App Store, am now trying to get it working on Android.

Do I need anything special for SQLite, like plugins or permissions and it hangs when reading opening a DB.

I create the DB in main.lua and it goes past that, so presuming it’s creating it. But hangs with a busy spinny icon thing when going to a scene where the first thing it does is open the DB and then does a SELECT FOR.

Dave

Have you checked what the error is on the device log yet?

No plugins required but maybe the “android.permission.WRITE_EXTERNAL_STORAGE” permission. I’m not sure. Hopefully someone can clarify that.

There is one Android specific gotcha mentioned in docs:

When providing a file path to open(), make sure to use system.pathForFile(). Providing just a plain file name such as my.db will not work consistently across the simulator and devices, especially on Android.

How do I check the device log ?

I have that permission in my build.settings, also use pathForFile in all sqlite3.open commands

Dave

You do _ adb logcat Corona:v *:s _ in terminal. Check out this tutorial: http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

All sorted, it was actually not setting the activity indicator to false but no idea why (works fine on iOS). I just presumed the code was getting stuck somewhere as the activity indicator was staying on. I switched the activity indicator off completely and it’s all working fine.

But a good learning curve all the same, think the longest part was working out how to become a developer on a Android device (hit the build number 7 times)!

Dave

Have you checked what the error is on the device log yet?

No plugins required but maybe the “android.permission.WRITE_EXTERNAL_STORAGE” permission. I’m not sure. Hopefully someone can clarify that.

There is one Android specific gotcha mentioned in docs:

When providing a file path to open(), make sure to use system.pathForFile(). Providing just a plain file name such as my.db will not work consistently across the simulator and devices, especially on Android.

How do I check the device log ?

I have that permission in my build.settings, also use pathForFile in all sqlite3.open commands

Dave

You do _ adb logcat Corona:v *:s _ in terminal. Check out this tutorial: http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

All sorted, it was actually not setting the activity indicator to false but no idea why (works fine on iOS). I just presumed the code was getting stuck somewhere as the activity indicator was staying on. I switched the activity indicator off completely and it’s all working fine.

But a good learning curve all the same, think the longest part was working out how to become a developer on a Android device (hit the build number 7 times)!

Dave