getExternalStorage() and MTP behavior on Jellybean - android

Sometimes, while I run a development version of an app, I want to export the database so I can copy it over to a desktop, view the database there and ensure it is being edited correctly.
Normally I will call Environment.getExternalStorageDirectory() and copy the database there. However, Jellybean on the Galaxy Nexus threw me for a loop--I could not see the file via MTP! (Mac OS X File Transfer). If I use Wifi File Explorer to browse the files on the device, then I see the database file.
After doing some research, I'm guessing this is due to Jellybean's simulated user-specific external storage. That would be why it tells me it's writing to /storage/emulated/0/ instead of /sdcard for example.
Is there a way to tell Android "write this file to where it is world-readable (including MTP) instead of only making it available to apps run under the same user"?

I had the same problem. I couldn't see a txt file I'd written in the 'Download' folder with 'Android File Transfer'. The only solution I've found is to write an extra .txt file in the same folder where you write your file, then open that folder in an app like 'Astro File Manager' and delete the extra file. Now open 'Android File Transfer', close it, and open it again. Your desired file should appear now.
I use /storage/emulated/0/Download/ as path but it should work in any other folder.
I know it's not the perfect solution but for now it's all I have.
Hope this will work for you too!

Related

Understanding and accessing Android directories through Device File Explorer & default File manager app

(1) What is the purpose of Device File Explorer? is it like a third party app?
(2) for path 1: /storage/emulated/0/Android/data
Why am I getting permission denied in Device File Explorer of Android Studio(How do I give the permission?) even though I can access this through the emulator file manager app(sdk_gphonne_x86 is /storage/emulated/0/).
(3) I used AOSP emulator as mentioned in this answer only to find out that there is no directory of data in Android folder why though?
(4) for path 2: /data/data
I can access this directory in Device File Explorer but I can't even see this directory in emulator file manager app.
I understood the difference between path 1 & path 2 files stored through this answer.
(5) When I use getApplicationSupportDirectory() from the Path Provider package I get /data/user/0/com.itbf.flash_chat_flutter/files and I realized it is nothing but same as the data/data/com.itbf.flash_chat_flutter/files directory which means data/data is actually data/user/0 why is that so?
Any help would be really appreciated!

How can I see a pcap generated with "Shark for root" on my computer?

I rooted my Android phone, and installed "Shark for Root".
Then dumped a file with like 1 minute worth of traffic.
I can see the file on my Android device with Shark Reader. I can see it in "Yaffs Explorer".
But when I try to copy (share via email, upload to ftp, via the Windows Explorer), it doesn't work or doesn't show.
Doesn't work meaning:
FTP says "upload failed, transfer failed".
Share via email says "Cannot read attachment".
So looks to be some kind of permission problem, but in Yaffs explorer the permissions are -rw-rw-r-. So should be fine... But in Windows Explorer, I can't see it.
I even tried zipping the file via Yaffs Explorer, but even this zip file I can't see.
Is there anyone who knows how to copy this pcap file onto my computer so I can load it up in Wireshark?
Thanks!
I could not see them either on Windows File Explorer. When I checked with ES File Explorer there were pcap files. So, I simply put a dummy extension to the file (for example, shark_dump_12345.pcap to shark_dump_12345.pcap.zip using renaming function) and then File Explorer could see the zip file.
I copied that file to the computer and simply removed the ".zip" and opened it with Wireshark. I have no idea why File Explorer did not show pcap files.

How to copy file from PC to android tablet?

When I connect the android tablet to windows 7 I get 2 external devices, one of them (H) doesn't open.
When I open G:, I get this
If I want to copy an app (adobe reader) to the tablet, to which folder should I copy it?
This is the screen of the tablet:
Where should I access the folders and files from?
Any? Copy it over, navigate to the folder on your phone, and click on the APK and it'll install. Make sure you allow your phone to install apps from unknown sources first.
That folder looks like the Android SD Card. If you copy it to any folder, just browse to it using a File Manager and click it to install it. You could also copy it to Downloads, and then open the Downloads app to install the APK. Make sure you also have enabled Unknown Sources.

Android File Transfer cannot see a folder created by app

I've installed "android file transfer" on mac.
My app creates a folder and creates a file in it (the permissions exist in AndroidManifest.xml), writes some data into this file.
File exists, I can access it using standard file manager in my android device. It shows many folders, including my folder and I can even see the contents of my file on the device.
But the problem is that "android file transfer" shows me all other folders, but not my folder and my file. I even tried create just a single file, not a directory. Same result.
Unplugging the device or re-launch of "android file transfer" didn't help.
Maybe "android file transfer" is broken tool?
Maybe "android file transfer" is broken tool?
No.
On Android 3.0+, you need to have your file be indexed by the media scanner before it will be visible over MTP to your Mac. The static scanFile() method on MediaScannerConnection is your best option IMHO.
I just had a similar problem. For Android 6.0.1, simply restarting the device solved the problem.
Here is an easy tool that calls the Android Media Scanner.
https://play.google.com/store/apps/details?id=com.addz.mediascanner&hl=en
Install it on your Android device, run it, and the missing files should show up in Android File Transfer on your computer.

How to push a file on a phone running Android 4.0.3?

I've created an app on Android 2.2 and used emulator to to test the app. Also the app needs two files to be pushed, file A.xml onto data/data/com.android.myApp/files/A.xml and a sqlite database B.db onto data/data/com.android.myApp/databases/B.db.
Now I'm trying to test the app on a Galaxy S2 running Android 4.0.3 where I can't find any of those familiar folders. There are four folders: data, mnt, system, tmp. The data folder is empty and to add to my problem I can't find my application on the File explorer.
How can I find my app and push these files?
You don't have read permission on data folder.
you can follow this
First, put A.xml and B.db to assets folder
then open by
InputStream is = c.getAssets().open("A.xml");
The folder structure is no different than on earlier emulator versions. It might be that you need to be root in order to be allowed to list the contents of the /data directory.
One cannot see the contents of the /data directory of an actual device due to security reasons. Maybe you could use the PackageManager to seek more details on the packages installed.

Categories

Resources