Hey guys i want know how to save data to external storage on Android like external usb memory.
Is for backup purpose
Thanks
How save data on external storage Android
How save data on external storage Android
Hugo Diaz Nuñez
Dominican Republic
Dominican Republic
Re: How save data on external storage Android
The security restrictions in Android mean that an application is only allowed to write to one special per application folder on an external SD card. This folder varies from device to device. To get the folder path for your device use the pathname function with CSEntryExternal. On my tablet the folder is /storage/extSdCard/Android/data/gov.census.cspro.csentry/files but this may be different on your device. We have also seen some devices where even though there is an external SD card the device does not support copying to it from apps other than the built in file explorer.
Here is a code snippet that copies the file data.csdb from the application folder to a folder named backup concatenated with the current time on the external SD card:
Here is a code snippet that copies the file data.csdb from the application folder to a folder named backup concatenated with the current time on the external SD card:
string backupFolder = pathname(CSEntryExternal) + maketext("Backup%d",timestamp());
dircreate(backupFolder);
filecopy(pathname(Application) + "data.csdb",backupFolder);
dircreate(backupFolder);
filecopy(pathname(Application) + "data.csdb",backupFolder);
Re: How save data on external storage Android
Dear teams
How to fix this problem while trying to copy to Android sd card. But I wrote the logics correcrly.
How to fix this problem while trying to copy to Android sd card. But I wrote the logics correcrly.
- Attachments
-
- Errors message while trying to copying
- Screenshot_2017-11-23-10-56-34.jpg (205.47 KiB) Viewed 6336 times
Re: How save data on external storage Android
Sir how about in making backup on internal storage, incase there is no sdcard installed..what is the logic to be used?
Re: How save data on external storage Android
You can just filecopy() as above but instead of pathname(CSEntryExternal) use pathname(CSEntry) to get the path to the CSEntry directory on the device storage.
Re: How save data on external storage Android
Sir i tried sa pathname (CSEntry) its says backup complete.but i only creates the folder, no data files copied..
Here is my folder structure
CrPS (main folder)
Program (sub folder)
Menu (sub folder,where the command backup data files is here)
Data(sub folder,where data files located)
CrPS\Program
CrPS\Menu
CrPS\Data
Here is my folder structure
CrPS (main folder)
Program (sub folder)
Menu (sub folder,where the command backup data files is here)
Data(sub folder,where data files located)
CrPS\Program
CrPS\Menu
CrPS\Data
-
- Posts: 1
- Joined: April 29th, 2020, 1:55 am
Re: How save data on external storage Android
pollyp20 wrote: ↑June 22nd, 2020, 7:14 pm Sir i tried sa pathname (CSEntry) its says backup complete.but i only creates the folder, no data files copied..
Here is my folder structure
CrPS (main folder)
Program (sub folder)
Menu (sub folder,where the command backup data files is here)
Data(sub folder,where data files located)
CrPS\Program
CrPS\Menu
CrPS\Data
- Attachments
-
- Capture.JPG (61.82 KiB) Viewed 4205 times
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: How save data on external storage Android
I am also using compress function for backup to save space.
best.
a.
Code: Select all
compress (concat(SDPathdatetime, ".zip"), csdbfiles);
a.