Pushing File into Android Device - push

I have developed an application which read text file. In Emulator I have push the file in
\Data\Data\PackageName\File.txt and its working fine. But when I try to push file in Device its generate the error Read Only File System. I have try to remount directory as writable but the same error. Please help me how can I push file into device.

The folder you are trying is locked on non-rooted phones i.e no write permission and I guess the device you are trying on is not a rooted one. since emulator is sort of developer device which is said to be rooted that's why you can push file to that location.
So depending on your requirement you have to either use Assest folder or File system storage
Update: How to use assest folder
Resources r = getResources();
AssetManager assetManager = r.getAssets();
InputStream in = assetManager.open(filename);

In practice, we can push such file in assets folder. Assets folder is there for you to put such raw files to be used inside the application.

Related

Flutter - Where should I save downloaded files?

I am building a flutter app (iOS/Android/MacOS/Windows/Web) which is able to download files, selected by the user. But where should I save those files? On MacOS/Windows its easy using path_provider and get the path of the downloads folder.
But where should I save the files on the other platforms? The downloads folder would be perfect because the users are able to use those files (.pdf) even without using the app, so the files are not app specific.
If you wish to save in download directory you can use
Directory appDownloadDir = await getDownloadsDirectory();
String appDownloadPath = appDownloadDir.path;
Or
getExternalStorageDirectory()//android
getApplicationDocumentsDirectory()// ios doesnt support access to download folder

Can not find the cached files (through flutter_cache_manager) on device

I am using this code to cache files on my local storage:
var audioFile = await DefaultCacheManager().getSingleFile('fileUrl');
I need to physically access the file to see if the user can access it from the file manager. When I run the app, the files are being cached. But I can not find the path where the files are cached on the device.
This is the address that I get on debug mode:
"/data/user/0/{my_package_name}/cache/libCachedImageData/3a65ece0-5366-11eb-91e0-0f0ba53cd292.mp4"
But there is no such path on my device.
It is a path to a "hiden" folders on your device. You can navigate to this path with root privileges or get (and navigate) the data by tutorials like this. Also you can find this folders without any permissions on Android emulator from File Explorer tab in Android Studio.

How to copy files in iPhone /var/mobile/Container/Data/Application/Document

I develop a test app for iPhone which needs to read some file. In simulator I copied those files showed by NSSearchPathForDirectoriesInDomains. Now I try to run the same app in iPhone and it is showing /var/mobile/Containers/Data/Application/ED49734D-0E61-4BB4-B3CC-D462F3BF9215/Documents/
location, but I don't know how to put my files in Documents folder so it can be read by my app.
Please help
To copy your files, you need to:
Make sure your iPhone is jail-braked (otherwise, you wont be able to access this folder)
Install tweak from Cydia: Apple File Conduit "2" (this is version for iOS 8/9)
Transfer files with one of the following PC tools:
iTools
iFunbox
Hope this helps

How to extract sms.db from non-jailbroken iphone on linux

Objective: Extract the sms.db sms text message database from an Iphone 4S.
I have installed ifuse on ubuntu 12.04 and am able to browse certain folders. None seem to contain the 'sms.db' file.
It is possible to extract the sms.db using freely available tools on linux?
I don't know yet how to access the SMS.DB file directly from the phone. But if you backup an iPhone using for example iTunes, you can then read the SMS.DB file from within the backup. It will be SHA-1 hashed (the file name will be gibberish), but it should still be a .DB file. You'll need iPhone Analyzer to unhash the file names, or something similar. Then you can load it into SQLite.
Please post here if you find a solution.
I've figured out a way on how to access it with Jailbroken devices... It miiiiiight be the same if you aren't jailbroken based on what the Github says (https://github.com/libimobiledevice/ifuse)
Anyways, open a terminal
Sudo su
now make a folder in your home and direct ifuse to that folder
ifuse --root /home/<INSERT NAME>/<INSERT NAME OF FOLDER>
Now you gotta open that folder as root
nautilus
Browse through your /home/ and find the folder.
It should be in
/var/mobile/Library/SMS/sms.db
Then you just copy it to your desktop and your good to go!

when i am adding folder from other app to my app am getting error like no such file or directory

i am adding folder from other app folder and then put that folder in my app and i import folder files to my app file but i am getting error like no such file or directory while running.
If you're attempting to move folders between running iPhone applications, you can't because of the application sandbox that isolates the applications from each other.
If you're attempting to add files and folders to an Xcode project, you need to make sure they are added to the appropriate target. If they are resources like images, sounds, plist etc you must have Xcode copy them to the project folder to ensure they are included in the final product.