{ "id": "63796", "key": "TIMOB-3164", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "11246", "name": "Sprint 2011-11", "archived": true, "released": true, "releaseDate": "2011-03-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T02:01:05.000+0000", "created": "2011-04-15T03:38:28.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "feature", "release-1.7.0", "rplist" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T02:01:05.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

Problem

\n

When you save an image to the SDCard, the media scanner won't\npick it up until the next time it runs (when the phone\nrestarts).

\n

Solution

\n

Exposing the MediaScannerConnection would let developers get the\nimage into the gallery right away.

\n

Android Documentation

\n

\nhttp://developer.android.com/reference/android/media/MediaScannerCo...

\n

Associated Helpdesk Ticket

\n

http://developer.appcelerator.com/helpdesk/view/69031

{html}", "attachment": [ { "id": "18271", "filename": "fj.jpg", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:38:29.000+0000", "size": 114242, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "Android: Expose MediaScannerConnection", "creator": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "environment": null, "comment": { "comments": [ { "id": "130201", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [8e7685715cea203abbe9df1c9e2f42f6aafe3e0a])\nDoc for scanMediaFiles [#3164] \nhttps://github.com/appcelerator/titanium_mobile/commit/8e7685715cea...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:38:30.000+0000", "updated": "2011-04-15T03:38:30.000+0000" }, { "id": "130202", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [b4a40009d732f8a233f7fce967c7874c3f817790])\nExpose the Android media scanner's file scanning service via\nTi.Media.Android.scanMediaFiles. [#3164]\n\nhttps://github.com/appcelerator/titanium_mobile/commit/b4a40009d732...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:38:31.000+0000", "updated": "2011-04-15T03:38:31.000+0000" }, { "id": "130203", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

QE testing:

\n

Here is a good test app.js:

\n
\nTitanium.UI.setBackgroundColor('#000');\nvar win = Titanium.UI.createWindow({  \n    title:'Test',\n    backgroundColor:'#000',\n    exitOnClose: true\n});\n\nvar lbl = Ti.UI.createLabel({\n    backgroundColor: 'blue',\n    color: 'yellow',\n    bottom: '10dp',\n    height: '80dp',\n    left: '5dp',\n    right: '5dp'\n});\nwin.add(lbl);\n\nvar btn = Ti.UI.createButton({\n    title: 'Do scan'\n});\nbtn.addEventListener('click', function(){\n    var f = Ti.Filesystem.getFile('fj.jpg');\n    f.copy(\"appdata://fj.jpg\");\n    f = Ti.Filesystem.getFile(\"appdata://fj.jpg\");\n    Ti.API.info(f.nativePath);\n    Ti.Media.Android.scanMediaFiles([ f.nativePath ], null, function(e) {\n        if (e.uri) {\n            lbl.text = e.uri;\n        } else {\n            lbl.text = \"No uri\";\n        }\n    });\n});\nwin.add(btn);\nwin.open();\n
\n

Put the attach fj.jpg in your Resources folder. Run the app,\nclick the button and confirm that you get a URI in the little\nconsole label at the bottom. \"No Uri\" means it didn't work. After\nyou see that the uri is there, you can go to the Android Gallery\napplication and see the photo (a picture of the casket of Emperor\nFranz Josef of Austria).

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:38:31.000+0000", "updated": "2011-04-15T03:38:31.000+0000" }, { "id": "130204", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested with Titanium SDK version: 1.7.0 (03/22/11 09:36 42d2187)\non
\nEmulator 2.1
\nSamsung Nexus S 2.3.2

{html}", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:38:31.000+0000", "updated": "2011-04-15T03:38:31.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }