[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16387629#comment-16387629 ] ASF GitHub Bot commented on CB-7487: tvanesse commented on issue #81: CB-7487 [Android] Broadcast file write URL: https://github.com/apache/cordova-plugin-file/pull/81#issuecomment-370742949 @dpeacock Thanks for your support, I successfully tested the patch locally and will open an issue on Jira as you suggest, then a PR on Github. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android, cordova-plugin-file >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland >Priority: Major > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16378687#comment-16378687 ] ASF GitHub Bot commented on CB-7487: dpeacock commented on issue #81: CB-7487 [Android] Broadcast file write URL: https://github.com/apache/cordova-plugin-file/pull/81#issuecomment-368900560 @tvanesse For a move I'm not sure whether you would need to do it on both the dest and src file, you would have to try I guess or read up on the best practices. But you have the right idea of what's required. The best way to test this would be to 'Fork' the plugin from github, you'll see the icon on the main page. You can then use your favourite Git tool (something like GitKraken for example) to download the source locally and work on it. From your cordova project remove the cordova-plugin-file. You can then either add the plugin specifying your local path, or if you have pushed the changes to your Git repo you can add the plugin using your repo's URL. Each time you make a change you can remove and re-add the plugin. One other thing to note is in some older cordova versions I've had issues where sometimes removing and re-adding the plug-in wasn't working quite right. Doing a cordova platform remove android then re-adding it seemed to solve it. You shouldn't have to do this, but if you run into issues it might be worth trying. Working from Git is best, because once you're satisfied with the changes you can then make a pull request to get your fixes moved into the main plug-in. I would suggest you create a bug on the Cordova Issue tracker for this so you can reference it in your pull request https://issues.apache.org/jira/projects/CB/issues Hopefully that's enough to get you going. I know there were some good blog posts (much more detailed) about this as well that you could probably google if you get stuck. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android, cordova-plugin-file >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland >Priority: Major > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16378645#comment-16378645 ] ASF GitHub Bot commented on CB-7487: tvanesse commented on issue #81: CB-7487 [Android] Broadcast file write URL: https://github.com/apache/cordova-plugin-file/pull/81#issuecomment-368894647 @dpeacock Thanks for your quick response. Now I am not really familiar with cordova plugins development but I guess adding `broadcastNewFile(srcFs.toNativeUri(srcURL));` at the end of `copyFile` in `LocalFileSystem.java` should do the job (around line 280). As I said, I'm not sure how I should set up my environment so that my application uses my locally modified plugin. I can modify the plugin directly in my Ionic project (yes, I'm using ionic) but I don't know how to force Cordova to re-compile the plugin. Can you help me on this? Cheers. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android, cordova-plugin-file >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland >Priority: Major > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16378619#comment-16378619 ] ASF GitHub Bot commented on CB-7487: dpeacock commented on issue #81: CB-7487 [Android] Broadcast file write URL: https://github.com/apache/cordova-plugin-file/pull/81#issuecomment-36158 @tvanesse you are correct, my fix was only for writing files as that's all I was using the plug-in for. It would make sense that if you were moving/copying the files the same function I implemented (broadcastNewFile) should be called. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android, cordova-plugin-file >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland >Priority: Major > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16378419#comment-16378419 ] ASF GitHub Bot commented on CB-7487: tvanesse commented on issue #81: CB-7487 [Android] Broadcast file write URL: https://github.com/apache/cordova-plugin-file/pull/81#issuecomment-368837843 Wait. I think your fix only applies when you *write* to a file. The broadcast isn't triggered if you *move* or *copy* an existing file. I'll try to update the code and, if that works, open a separate PR for that. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android, cordova-plugin-file >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland >Priority: Major > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16376949#comment-16376949 ] ASF GitHub Bot commented on CB-7487: tvanesse commented on issue #81: CB-7487 [Android] Broadcast file write URL: https://github.com/apache/cordova-plugin-file/pull/81#issuecomment-368520653 Hey guys, I'm still experiencing the same problem with `5.0.0` when the Android device is connected to a Raspberry Pi 3 running standard Raspbian. That is, the Raspberry can't see the file over MTP unless the Android device is rebooted or the file is manually renamed from the native Android file browser. Do you know how I could get this to work with the Pi? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android, cordova-plugin-file >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland >Priority: Major > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14176967#comment-14176967 ] Ian Clelland commented on CB-7487: -- Certainly; it should probably be a separate (related) issue, though. > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14176954#comment-14176954 ] Joe Bowser commented on CB-7487: Can we get this code shared with Camera somehow? > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14176936#comment-14176936 ] ASF GitHub Bot commented on CB-7487: Github user dpeacock closed the pull request at: https://github.com/apache/cordova-plugin-file/pull/81 > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14160936#comment-14160936 ] ASF GitHub Bot commented on CB-7487: Github user clelland commented on the pull request: https://github.com/apache/cordova-plugin-file/pull/81#issuecomment-58098186 Merged! You can close this PR any time. (I squashed the two commits together, and rebased against the current head, so github won't automatically close the issue :( ) > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14160934#comment-14160934 ] ASF subversion and git services commented on CB-7487: - Commit 4a820172fdb0ca1571faa552016c35dba96e0d7c in cordova-plugin-file's branch refs/heads/master from [~dpeacock] [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-file.git;h=4a82017 ] CB-7487 [Android] Broadcast file write This allows MTP USB shares to show the file immediately without reboot/manual refresh using 3rd party app. > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137700#comment-14137700 ] ASF GitHub Bot commented on CB-7487: Github user dpeacock commented on the pull request: https://github.com/apache/cordova-plugin-file/pull/81#issuecomment-55938319 Added the fix to check for file exists instead of null check. > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137664#comment-14137664 ] ASF GitHub Bot commented on CB-7487: Github user dpeacock commented on a diff in the pull request: https://github.com/apache/cordova-plugin-file/pull/81#discussion_r17682048 --- Diff: src/android/LocalFilesystem.java --- @@ -589,6 +593,32 @@ public long writeToFileAtURL(LocalFilesystemURL inputURL, String data, return rawData.length; } + +/** + * Send broadcast of new file so files appear over MTP + * + * @param inputURL + */ + private void broadcastNewFile(LocalFilesystemURL inputURL) { + //Get the activity + Activity activity = this.cordova.getActivity(); + + //Get the context + Context context = activity.getApplicationContext(); + + //Get file + File file = new File(this.filesystemPathForURL(inputURL)); + if (file != null) { --- End diff -- Agreed, I will update this. > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137663#comment-14137663 ] ASF GitHub Bot commented on CB-7487: Github user dpeacock commented on a diff in the pull request: https://github.com/apache/cordova-plugin-file/pull/81#discussion_r17681983 --- Diff: src/android/LocalFilesystem.java --- @@ -579,6 +582,7 @@ public long writeToFileAtURL(LocalFilesystemURL inputURL, String data, // Always close the output out.close(); } + broadcastNewFile(inputURL); --- End diff -- I agree with what you are saying here. By the time we are in writeToFileAtURL it seems the file already exists, so I tried moving this logic to getFileForLocalURL. In here I was checking if the file existed prior to creation, then broadcasting if it was created. The results however were strange. Though the files would appear, they would sometimes be 0 bytes in size. Trying to debug the javascript portion always resulted in 0 byte files. I then tried re-testing the broadcast after the write (where it is in this commit) and it seems to work as expected. I can't really explain why this occurring, perhaps you have some insight on this? If not, I think it's probably best to leave the broadcast after every write to be safe. > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137325#comment-14137325 ] ASF GitHub Bot commented on CB-7487: Github user clelland commented on a diff in the pull request: https://github.com/apache/cordova-plugin-file/pull/81#discussion_r17667256 --- Diff: src/android/LocalFilesystem.java --- @@ -579,6 +582,7 @@ public long writeToFileAtURL(LocalFilesystemURL inputURL, String data, // Always close the output out.close(); } + broadcastNewFile(inputURL); --- End diff -- Does this happen on every file write? If so, should we try to ensure that it happens only when new files are created, or does it need to be called every time a file changes? > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137321#comment-14137321 ] ASF GitHub Bot commented on CB-7487: Github user clelland commented on a diff in the pull request: https://github.com/apache/cordova-plugin-file/pull/81#discussion_r17667021 --- Diff: src/android/LocalFilesystem.java --- @@ -589,6 +593,32 @@ public long writeToFileAtURL(LocalFilesystemURL inputURL, String data, return rawData.length; } + +/** + * Send broadcast of new file so files appear over MTP + * + * @param inputURL + */ + private void broadcastNewFile(LocalFilesystemURL inputURL) { + //Get the activity + Activity activity = this.cordova.getActivity(); + + //Get the context + Context context = activity.getApplicationContext(); + + //Get file + File file = new File(this.filesystemPathForURL(inputURL)); + if (file != null) { --- End diff -- What is this comparison for? I'm pretty sure that `new` can't ever return `null`. It also doesn't check for file existence; you'd want `file.exists()` for that. > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136431#comment-14136431 ] Joe Bowser commented on CB-7487: Awesome! > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136428#comment-14136428 ] David Peacock commented on CB-7487: --- I filled out an ICLA about a year ago when I submitted some BB10 fixes. It's showing up as "Dave Peacock" under http://people.apache.org/committer-index.html > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock >Assignee: Ian Clelland > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14123689#comment-14123689 ] ASF GitHub Bot commented on CB-7487: GitHub user dpeacock opened a pull request: https://github.com/apache/cordova-plugin-file/pull/81 CB-7487 [Android] Broadcast file write This allows MTP USB shares to show the file immediately without reboot/manual refresh using 3rd party app. You can merge this pull request into a Git repository by running: $ git pull https://github.com/dpeacock/cordova-plugin-file CB-7487 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-file/pull/81.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #81 commit 69ac5a0e0ce3fbe8cd9cad1449dc1c7cbcc07a35 Author: David Peacock Date: 2014-09-05T22:10:39Z CB-7487 [Android] Broadcast file write This allows MTP USB shares to show the file immediately without reboot/manual refresh using 3rd party app. > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14123594#comment-14123594 ] ASF GitHub Bot commented on CB-7487: Github user dpeacock closed the pull request at: https://github.com/apache/cordova-plugin-file/pull/80 > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-7487) Writing a file doesn't show up on android MTP
[ https://issues.apache.org/jira/browse/CB-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14123591#comment-14123591 ] ASF GitHub Bot commented on CB-7487: GitHub user dpeacock opened a pull request: https://github.com/apache/cordova-plugin-file/pull/80 CB-7487 [Android] Broadcast file write This allows MTP USB shares to show the file immediately without reboot/manual refresh using 3rd party app. You can merge this pull request into a Git repository by running: $ git pull https://github.com/dpeacock/cordova-plugin-file master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-file/pull/80.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #80 commit b9f0cf08144fae254ec0e4a21b8951b1c97c9ac1 Author: David Peacock Date: 2014-09-05T21:10:53Z CB-7487 [Android] Broadcast file write This allows MTP USB shares to show the file immediately without reboot/manual refresh using 3rd party app. > Writing a file doesn't show up on android MTP > - > > Key: CB-7487 > URL: https://issues.apache.org/jira/browse/CB-7487 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File >Affects Versions: 3.4.0 > Environment: Nexus 5 and Windows 7 >Reporter: David Peacock > > Using the file plug-in to write out a file works, but when you use MTP to > view the file when connected to USB on Windows the file doesn't show up. > The file shows up on the device or through adb. Rebooting the device or > using things to refresh the MTP will have the file appear. This was tested > on multiple Nexus 5 devices on multiple Windows 7 machines. > Cordova should be broadcasting ACTION_MEDIA_SCANNER_SCAN_FILE on the file to > have it appear immediately. > I will be submitting a pull request on the file plug-in for a fix I've tested > and confirmed that resolves this issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)