2017년 5월 22일 월요일

Produced by AI .txt file is not "visible" by my desktop


Dear friends im facing the following problem: I have done an application in AI2 that in its end, produces using the ".SaveFile" block,  a XXXXX.txt file stored in the "Android" folder (or in any other folder is desirable!) of a tablet. This tablet is connected through USB connection to my desktop. When I try to access this file through my desktop running windows 7, it is not "visible" by it, although it is really stored in the "Android" folder (I can see it!!!). If I store it to another folder (for example in "Alert") and copy-paste it to the "Android" it is normally "visible" by my desktop. Could someone help me? Is the storage of the AI2 responsible for that or something else is happened?

--
Best to save data you want to access via PC etc. to the "sdcard" or folder within it, other folders may not allow files to be viewable 

-- 
how do you save the file?
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

--
the blocks are as can you see above. The "FilePath" is provided as: "/Android/swdata.txt"
Thank you and Tim for your interest. I will try also Tim's idea.

-- 
.... I would like to add to the above comments that I tryed to save to "sdcard" but it seems that my tablet has not such folder. Instead I tryed to save the produced file in "/DCIM/Swimmer/XXXXX.txt". The file is now saved normally but still the desktop doesnt "see" it. The surprising element is that if I "click" on the file in my tablet with my finger,  then immediately the Desktop sees it!!!!

-- 
... additionally to the above I would like to note that I tryed to save my file to the "sdcard" but it seems that my tablet has not such folder. Instead, I saved it to the "/DCIM/Swimmer/XXXXX.txt". It has been saved normally but still the desktop doesn't see it! The surpising element is that when I "click" with my finger on the file on my tablet, while the computer is looking for it, it is "seen" by it!!!!!

-- 
... additionally to the above I would like to note that after adding an SD card to my tablet, I tried to save my file to the "sdcard" but it seems that the file is not saved in SD card (I really dont undrestand why!). The path I gave is: "/sdcard/swdata.txt". I get the message:" The file: /Storage/emulated/0/sdcard/swdata.txt" could not be created. Instead, I saved it to the "/DCIM/Swimmer/swdata.txt". It has been saved normally but still the desktop doesn't see it! The surpising element is that when I "click" with my finger on the file on my tablet, while the computer is looking for it, (sometimes) it is "seen" by it!!!!!

-- 
are you able to find the file, if you use a file manager app directly on your device?
the file component of App Inventor is only able to save files in the internal sdcard...

if you use /swdata.txt the file should be saved in the root directory of the internal sdcard

-- 

Using a file Manager I get the screenshot shown above. It seems that the file of interest exists in the SD card! (the length of the file is 24Bytes?!?!?!). However if I enter in the SD card, I can't find it as you can see in the following screenshot! Also the search results are negative when I am searcing for it, in the tablet contents:


I really appreciate your help.

--
This tablet is connected through USB connection to my desktop. When I try to access this file through my desktop running windows 7, it is not "visible" by it, although it is really stored in the "Android" folder (I can see it!!!)



try these tips
https://www.google.com/search?q=android+usb+file+not+visible+on+windows

-- 
Nothing! I am completely dissapointed! I tried almost everything.
Although Im writing the produced file as: /swdata.txt in the tablet (including an SD card) it is stored in the Device Storage and NOT in the SD card as it is expected according to:

http://ai2.appinventor.mit.edu/reference/components/storage.html#File
In this case the file is not seen by the desktop, except if I copy and paste it to another folder of the tablet!

If I include: /sdcard/swdata.txt Im getting a error message: Error: the file could not been saved in /Storage/emulated/0/sdcard/swdata.txt
If I map the tablet as drive Z: (using a suitable program) the desktop is able to "see" the tablet's files but not the SD card.
I cant really understand the reason why AI2 does not produces immediately "visible" .txt (or may be of other type) files!!!
A question that arises: is it possible to produce using AI2 another type of archive, for example EXCEL file or to send the data directly through USB connection to the desktop or I will face the same problems again??

-- 
Using a file Manager I get the screenshot shown above. It seems that the file of interest exists in the SD card!

which means, it's not an App Inventor issue...
and as already said, the file component can only store files in the internal sdcard (and NOT in the external sdcard)

the links https://www.google.com/search?q=android+usb+file+not+visible+on+windows should give you a solution how to find the stored file using WIndows

you can't create excel format, but csv format, which you can import into Excel

 or to send the data directly through USB connection to the desktop

you might want to try Jörg's SMP Manager extension

-- 
Consider using a Fusion Table to collect your data in AI2.


Benefits:
⦁ You can see the data on the Web AND on AI2
⦁ You can share the data with others
⦁ You can export it in csv format
⦁ You can run most SQL against it (no JOINs, though)
⦁ Data is stored in your (mostly) free Google Drive

Start with the Pizza Party tutorial.

-- 
Dear Taifun and Abraham, I really appreciate too much your help.
I will try your suggestions and I will let you know.

-- 
If my understanding is right, the method of using Fusion Table needs an active connection with the internet in order to retrieve the data. This is not desirable, since I am working (in the context of my Masters Thesis) on the implementation of a portable system with no such capability.
Could you suggest me an alternative solution?
For example could I transfer the file (containing just four (4) numbers and nothing else!!!) using the direct USB connection with the desktop?

-- 
Here are more things to try ...

(Server Message Block protocol creates network shares for Windows)


Bluetooth 
Does your PC have Bluetooth?
Some laptops do.

Voice output
(Modern PCs have speech input, rarely used)

Grabbing at straws,

-- 
A Fusion table requires an active Internet connection.  You can store text data on your device using a TinyDB.

You are using your phone/tablet to connect with App Inventor using a USB cable?   If you are doing that, you had to load software on your PC and change a setting in the Developer's options on your Android using the Settings on the device., if you want to access a file stored on the 'internal SD' card .. you have to reset the so that your device responds as a media device. If you save a text file on your device on the internalSdCard, you can read it on your PC provided you save it with a .txt suffix.  Just plug your Android into your PCs usb slot and then brows for your file using File Explorer on your PC.

If you create a text file, you should be able to eMail it to your self.  How you do this depends on the text file and where it is stored.

Save many txt files in a TinyDB on the device and later retrieve them to display or eMail the text.

--
Lets state the problem again: I'm using the following arrangment: One desktop PC running windows 7 is connected permanently through a USB cable to a Samsung tablet running Android. In the tablet an application developed by us, using AppInventor, creates a XXXXX.txt file upon some event occurance. The blocks creating the file in our app are shown above in my post of 18 May. The storage path is : "/Android/XXXXX.txt", or (we tryed also) directly: "/XXXXX.txt"
We have mapped also the tablet (Using MTPDrive software) as external Drive Z:\ to our PC. Our desire is, when the XXXXX.txt is produced in the tablet it must be "seen" immediately and without our intervention to the file manager of the desktop. The problem with this arrangment is that although the file is produced, it is not "visible" by the desktop. If we copy this file from the tablet's sdcard (or from the Adroid file-if it is stored there) and paste it to the same folder, it is immediately seen by the desktop. Sometimes the XXXXX.txt file is also "seen" if we mannually search in the desktop in other directories, open a randomly selected  file, close it, and then return to Z:\.
Regarding your answer please clarify the following points:
"If you are doing that, you had to load software on your PC ..."
what "softwre do you mean? The MTPDrive for example, or something else?

"and change a setting in the Developer's options on your Android using the Settings on the device., if you want to access a file stored on the 'internal SD' card ..  
can you be more specific to which setting are you refered because we have tryed a lot but with no result?

"you have to reset the so that your device responds as a media device."
something has been missed between "the" and "so"?

"If you save a text file on your device on the internalSdCard, you can read it on your PC provided you save it with a .txt suffix."  
it has been done exactly in this way.

Thank you for your interest. 

-- 
Our desire is, when the XXXXX.txt is produced in the tablet it must be "seen" immediately and without our intervention to the file manager of the desktop. The problem with this arrangment is that although the file is produced, it is not "visible" by the desktop     



You  can NOT do that.  You are using the USB debugging feature to develop.  You cannot simultaneously use the device as a PC drive  AND as a AI development too.  You cannot view files from your device using the FileManager on your PC at the same time you are running the app.  Connecting the device to the PC without  USB debugging only allows you to VIEW files that are on the device when the app is not running.

You said " the method of using Fusion Table needs an active connection with the internet in order to retrieve the data. This is not desirable, since I am working (in the context of my Masters Thesis) on the implementation of a portable system with no such capability."    This means you will not have a network connection.  However, you could design your app to show the several numbers you are collecting on your Android and not have to send store the file but could later upload it when you get where you have a connection.

You might look at this app  http://jabmobilecomp.strikingly.com/   (the plant data one first and possibly the species area one)   and see if it meets your needs. The app downloads field data and stores it internally using a TinyDB and can be later used to upload data to a FusionTable.

Regarding your answer please clarify the following points:
"If you are doing that, you had to load software on your PC ..."
what "softwre do you mean? The MTPDrive for example, or something else? from  
Connecting to a phone or tablet with a USB cable   


Setting up a USB connection can be awkward, especially on Windows machines, which need special driver software to connect to Android devices. (This is not the case with Mac or Linux, which do not need special drivers.) Unfortunately, different devices may require different drivers, and, outside of a few standard models, Microsoft and Google have left it to the device manufacturers to create and supply the drivers. As a consequence, that you may have to search on the Web to find the appropriate driver for your phone. App Inventor provides a test program that checks if your USB-connected device can communicate with the computer. You should run this test and resolve any connection issues before trying to use App Inventor with USB on that device.

"and change a setting in the Developer's options on your Android using the Settings on the device., if you want to access a file stored on the 'internal SD' card ..  
can you be more specific to which setting are you refered because we have tryed a lot but with no result?


To get the usb to work, you had to do this:


Step 4: Set up your device for USB (Turn USB Debugging ON)

On your Android device, go to System Settings, Developer Options, turn them on, and be sure that "USB Debugging" is allowed.
On most devices running Android 3.2 or older, you can find this option under Settings > Applications > Development.
On Android 4.0 and newer, it's in Settings > Developer options.
Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options, including "USB Debugging".

You need to undo this.  Then unplug the USB from the PC, then plug it back it; when you plug it back in the phone will work like an extra disk drive on the phone.


"you have to reset the so that your device responds as a media device."
something has been missed between "the" and "so"?    the USB debugging  
In your case USB debugging is checked; just uncheck it and then replug the device back into your PC.

"If you save a text file on your device on the internalSdCard, you can read it on your PC provided you save it with a .txt suffix."  
it has been done exactly in this way.     Provided that you disable USB Debugging you should be able to find the file on the phone.  Where it will be depends on the file path you provided.

What you are trying to do is very awkward.  I would just email the text that is in the file to yourself but you got to do what you got to do since you cannot or use a technique like the species area map does.

-- 
Does the new file appear when you press F5 in your Windows File Manager window?

If so, maybe this will help ...

-- 
finally and with your helpfull guidance we found the following solution:
in the Windows command prompt I wrote: C:∖Users∖USER∖xcopy C:∖∖Test Z:∖∖
where "Test" is an empty folder. The desktop writing the empty folder in the tablet (which using the MTPDrive software has assigned as drive "Z:∖∖") returns the new content of the sdcard of the tablet.
Thus the XXXXX.txt file contained in the tablet is finally visible by the desktop and can be used by another software running in it.
Thank you for your time and your valuable assistance
Ioannis  

-- 
Very glad you found a solution Ioannis.  What you are doing to store/view the data appears very awkward.  It evidently works for you. I expect there are better ways to handle and save your data collection (see the links I provided for two possible solutions).  

--  
it really works very efficiently. I tryed all methods proposed, but without result. For example: Pressing F5 the file is still not vissible. I tryed to make a single copy through the Windows command propmt of the contents of Z:\ to C:\ with no result. I tryed to change the settings of my tablet (it will take a lot of pages to describe all what I have tryed) also with no result. I tryed (using the application running in the android environment) to copy and paste the file to another folder inside the tablet, nothing (although this process works "manually"). So I am very happy with this working solution!

-- 


댓글 없음:

댓글 쓰기