Page 1 of 1

Need Help..! How can I get my database on my andriod phone.?

Posted: Mon Jan 20, 2014 4:07 pm
by snop21
I have a problem of getting back my database on my andriod phone. All were running great But that's the only problem I have.

Here's my connection string where I save my database on my andriod app

----->>>>   put specialFolderPath("documents") & "/MyCmbs.db" into tDatabasePath

I can't access the root on my andriod because it's not rooted.

Is there anyway to get it back and save it into my computer?.

your help very much appreciated.

Thank you.

Re: Need Help..! How can I get my database on my andriod pho

Posted: Mon Jan 20, 2014 6:18 pm
by Mark
Hi,

Can you connect your phone to your computer and browse the file from there? From my computer, I can access all files and directories of my Android tablet.

Kind regards,

Mark

Re: Need Help..! How can I get my database on my andriod pho

Posted: Wed Jan 22, 2014 1:40 pm
by snop21
Hi Mark,

In mine I can't access the root file of my andriod some forum says we can just access it if our Andriod device is rooted. I am using Acer iconia B1.

Regards

-snop21

Re: Need Help..! How can I get my database on my andriod pho

Posted: Wed Jan 22, 2014 7:42 pm
by jacque
I can't think of any way to do this easily on an unrooted device. The data folders aren't accessible without root access.

One thing that might work is to use a Dropbox library and script your app to save a copy of the database to a Dropbox folder. There is one Android-compatible library available, but it requires some Dropbox setup to get an app ID and some other things I've never done, so I'm not sure how much work that is. There is a link to the libary in this forum somewhere, try a search for "phxDropboxLib".

If you are just looking for a way to back up the file, Helium can do it. It's available in the Play Store in both free and paid versions. The files it saves aren't in a useable form though, and only work when restoring with Helium.

Re: Need Help..! How can I get my database on my andriod pho

Posted: Wed Jan 22, 2014 9:04 pm
by Mark
Hi snop21,

If I understand you correctly, you're not trying to recover your own data but you're trying to find a way to store user data and reload these data after the user deletes and re-installs your app.

I suppose you don't want people to require a Dropbox account. That wouldn't give your users a professional impression of you, but you might offer them Dropbox as an option. Helium would be even worse.

If you want to be able to access a database as read-only, you can include the database in your standalone. The Standalone Application Settings window has a Files panel, where you can include your database. You can access this database with

Code: Select all

specialFolderpath("engine") & "/databasename.db"
If you want to create a new database with read and write access, you can do this in

Code: Select all

specialFolderpath("documents") & "/databasename.db"
You need no rooted device for this.

You can include an option for the user to keep a backup of the user data on your own web server. Just upload a dump of the data to your server, using LiveCode's post to URL command. (Unfortunately, libUrlMultipartFormData won't work on mobile devices). However, you can write a slightly smart PHP-script to receive chunks of data. I think you asked me elsewhere about PHP and I'll try to answer that question there.

Another solution would be FTP. After dumping your database into a variable, you can upload it with one command:

Code: Select all

put myData into url "ftp://user:password@ftp.myserver.xyz/dir/userdatabase.gz"
Of course, this isn't really safe, because your username and password would be somewhere in the programme.

Re: Need Help..! How can I get my database on my andriod pho

Posted: Wed Jan 22, 2014 9:16 pm
by jacque
Just to be clear Mark, the Dropbox and Helium methods were intended to retrieve the file from an Android device for developer use, not to store and work with the data within the app itself. Your original response assumed the same thing, I think.

Re: Need Help..! How can I get my database on my andriod pho

Posted: Wed Jan 22, 2014 11:02 pm
by Mark
Jacque,

I *believe* that OP doesn't want a one-off solution or a custom solution for his/her own use, but instead something that allows him/her to keep a backup of the data if the app is removed by the user or if a similar situation occurs. I'm not entirely sure, though.

Best,

Mark

Re: Need Help..! How can I get my database on my andriod pho

Posted: Thu Jan 23, 2014 6:40 am
by snop21
hi Guys!

Thank you for giving me hint how to do it. you both had great Ideas..! :))

I'll try that all.. :))

Kudos Livecoders.. ! :))

Regards

-snop21