Edit data with new Device File Explorer in Android Studio 3.1 - android-studio-3.0

With a new Device File Explorer in Android Studio 3.1 I can open file from the device and see it's contents in Android Studio
File opens in edit mode and when I add some lines, save it and restart Android Studio and open this file again it's still empty.
Is there a way to save my changes to the device without clicking upload, locate and manually enter this file path?

You have to save the file on your computer, edit it and upload back the file on the device.

Related

Android 11: saving a file to the selected folder

In my app I use ActivityResultContracts.OpenDocumentTree() to let the user select a folder in the device storage and allow access to it.
However, on Android 11, if I try to save a file on the selected folder, I get this exception:
SecurityException: Permission Denial: opening provider com.android.externalstorage.ExternalStorageProvider from ProcessRecord ... requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
On Android 10- everything works.
So, how can I save a file to the selected folder on Android 11?

Read a iPhone log file content from Mac

How can I read a iPhone log file content from Mac?
I wanna read /Library/Caches/swiftybeaver.log in iPhone from my Macbook. The file log is generated by SwiftyBeaver
Connect your iPhone to your mac.
Open XCODE then select Devices and Simulators from Window Menu
Select your Application Package
Click on COG(Setting icon) and select download container
Save the file on Desktop or anywhere you want.
right click on downloaded file and select show package content
Access your log :)
for ref:

How to open database sqlite file on iPhone real device?

I'm debbuging a app in my real device by cable. I've a iPhone 6. I want check my database and operate with sqlite3 to query my results. The other questions and tutorials explain to do this only in simulator but I'm using a real iPhone.
In AppDelegate, I prints the path of database:
print(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last! as String)
/Users/myname/Library/Developer/CoreSimulator/Devices/DAE93E57-7004-45F6-9B93-E79CA1AEEEFA/data/Containers/Data/Application/D7A4F27E-6F11-4941-A1B0-0337ABF788AB/Documents
So, I take the path and access from terminal and access my database with sqlite3 DatabaseFile
But when I debugging in my device, the path that's printed not works. I tried use the printed path
cd /var/mobile/Containers/Data/Application/3257D423-C198-41A5-B29D-B31E99F84F34/Documents
/usr/bin/CD: line 4: cd: /var/mobile/Containers/Data/Application/3257D423-C198-41A5-B29D-B31E99F84F34/Documents: No such file or directory
This error happens because this is of iOS system, I think.
Xcode 10.1
In Xcode, go to Window > Devices and Simulators
In the Devices tab, select your application, then click on the Gear icon, then click Download Container...
Choose the location you want to save the file, then click on Save.
Go to Finder and find the .xcappdata file you just downloaded, then right click and select Show Package in Contents
The contents folder will open. Your .sql file is in AppData > Library > Application Support
I recommend downloading DB Browser for SQL File, and opening the .sql file with that. It works wonders!
In recent versions of Xcode (8 and up, I think), open this with Window menu --> Devices. Find the device in the device list and look at the installed apps list for the device. Each app that you've built and installed on the device will be listed (and maybe some others). Select your app and click the gear menu below the list. Clicking the "Download" item on the pop-up menu will enable you to copy the app's documents, library, and other directories to your Mac.
NB: This will download an .xcappdata file. Right-clicking on that and selecting "Show Package Contents" will allow you to drill down to the actual sqlite file.
Here's another way:
In debug mode, add a UIActivityViewController to share(copy) your SQLite database to a Mac or to a third party iOS app like SQLiteFlow(iOS), then you can debug your SQLite database.
Files that you've placed in the Documents directly should show up in File Sharing inside iTunes. You can download them locally and edit them there. You'll need to enable it in your app's Info.plist by adding:
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
The second key is actually only required if you want to enable showing these in the Files app.
You cannot access the .sqlite file in realtime when you debug your app using a device. Try accomplishing the same in the simulator and it will work.

How do I open an iOS simulator local .realm file in Realm Studio

Using realm browser I was able to print the path of the .realm file in the simulator and open it from the terminal (macOS) using:
open /Users/.../long path/.../default.realm
This doesn't seem to work with Realm Studio (it still tries to open with Realm Browser). Realm Studio has an "Open a local Realm" option on the splash screen, but that takes me to macOS's awful finder, which doesn't allow me to type in a path (Windows +1). Maybe I don't properly understand macOS's file structure, but it doesn't appear to be showing one of the directories I would need to navigate into to find the .realm
Does Realm Studio have a cli tool or cli method of opening?
The fact that Realm Studio does not yet open files in response to the open AppleEvent (sent by double-clicking on a Realm file in the finder, or using open on a .realm file) is a known issue.
In the mean time, you can open it via Realm Studio's Open panel by first copying the path, typing / when the Open panel is showing, then pasting the copied path into the text field that has appeared.

How to save a file with phonegap and find that file in Windows file system

I would like to save a file "readme.txt" inside my iphone with phonegap for logging pourpuses, I have tried to do the example provided by phonegap:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
everything seems to work just fine, my question is where can I find this file within the Windows File system?
I suppose you mean the Mac filesystem, and that you actually want to download the file you created.
If so, then this is what you should do:
1. Connect your iPhone to your Mac.
2. Open XCode's Organizer.
3. you'll see your iPhone in the "Devices" tab, on the left panel. Now, click "Applications".
4. Select your application and click the "Download" arrow at the bottom.
5. Type the desired file name and select the desired target directory.
6. Your application (and its related files) will now be saved in the target directory as a *.xcappdata file. Right-click this file and select "Show Package Contents".
7. A Finder window will be opened, displaying a directory called "AppData". Open this directory, then open its inner directory "Documents". You should find your log file at this path.

Resources