Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-23470

Android: Saving photos to external directory still causing app data size to grow

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      5.2.2 GA on Android

      Description

      Taking photos and saving them outside of the applicationdatadirectoy is causing the data size of the app to grow even though no data is being saved to the app.

      To reproduce, use the following code in app.js:

      var window = Titanium.UI.createWindow({
      	backgroundColor : 'white'
      });
       
      var _storage = Ti.Filesystem.applicationDataDirectory;
      if (Ti.Filesystem.isExternalStoragePresent()) {
      	_storage = 'file:///sdcard/';
      };
       
      var folder = Ti.Filesystem.getFile(_storage, 'images/');
      if (!folder.exists()) {
      	folder.createDirectory();
      	var saveLocation = 'images/';
      };
       
      var takePhoto = Titanium.UI.createButton({
      	title : 'Open Camera',
      });
       
      takePhoto.addEventListener('click', function(e) {
      	var timeInMs = Date.now();
      	Titanium.Media.showCamera({
      		showControls : true,
      		autorotate : false,
      		saveToPhotoGallery : false,
      		success : function(event) {
      			var image = event.media;
      			var file = Ti.Filesystem.getFile('file:///sdcard/images/', timeInMs + '.jpg');
      			file.write(image);
      		},
      	});
       
      });
       
      window.add(takePhoto);
      window.open({
      	fullscreen : true
      });
      

      Run the app and take not if the initial data size on the device.

      Repeatedly take photos and verify they are saved outside of the applicationdatadirectory in a folder called 'images'

      As photos are taken and saved, the data size of the app will continue to grow, even though the images are not in the app.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                jdbaron25 Jeremy S
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-9795
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code