×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2013
    Location
    India
    Posts
    13

    App's Storage does not clear

    Hi,
    I ran into another problem with my new app. I am using WebClient to connect to a server and download an mp3 file from there.

    After downloading the file , my app adds (moves) it to the Music Library. Now In testing, I used IsoStoreSpy to get information about files stored in my app. and it shows a "xx.tmp" (temporary) file is created for the webclient result and is deleted as soon as app is closed or a new request is sent.

    But when I published my app in beta, Nokia Storage check shows that app is using memory of the song downloaded and it does not clear up. I have even tried to forcefully delete all (except _appSettings) files in the App's Isolated Storage. But still no luck.

    Hope I have made myself clear.

    Any solutions to this problem ?

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2012
    Location
    Bilbao
    Posts
    53

    Re: App's Storage does not clear

    Hi!

    I think this problem is related to the "others" storage bug in Windows Phone OS not deleting temporal data using from downloads or streaming. As far as i know, this bug is addressed in GDR2 update and you don't need to do nothing special. if you test your app in a GDR2 updated device, surely it delete the temporal files correctly.

  3. #3
    Registered User
    Join Date
    May 2013
    Location
    India
    Posts
    13

    Re: App's Storage does not clear

    Thanks for the reply, But it's not other storage bug. Download does not get deleted from the App Memory. Storage Check shows increase in only app data, not others.
    And This is tested on GDR1+GDR2 devices. but the bug is there.

    P.S. while debugging the download is removed automatically (Checked with IsoStoreSpy), but not in the release.

    Quote Originally Posted by josueyeray View Post
    Hi!

    I think this problem is related to the "others" storage bug in Windows Phone OS not deleting temporal data using from downloads or streaming. As far as i know, this bug is addressed in GDR2 update and you don't need to do nothing special. if you test your app in a GDR2 updated device, surely it delete the temporal files correctly.
    Last edited by nsbabra; 2013-08-29 at 10:51.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    548

    Re: App's Storage does not clear

    Do you want to show some code on how you're downloading a file, moving it to the MediaLibrary then cleaning up?

    I'm sure there are many apps that do something similar yet I haven't heard reports of similar behaviour - and if it's an issue, it would be good to flag it with the Windows Phone team or post a work-around on the Nokia Wiki.

  5. #5
    Registered User
    Join Date
    May 2013
    Location
    India
    Posts
    13

    Re: App's Storage does not clear

    Edit 1 : Moderators can delete this thread or mark it as answered.. I found out the problem with the code and rectified it.

    Code Snippet :
    downloadFunction()
    {
    _webClient = new WebClient();
    _webClient.DownloadProgressChanged += WebClientDownloadProgressChanged;
    _webClient.OpenReadCompleted += _webClient_OpenReadCompleted;
    _webClient.OpenReadAsync(dataUri<link>);
    }
    ProgressChanged is for showing progress bare.

    _webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
    {
    _webClient.DownloadProgressChanged -= WebClientDownloadProgressChanged;
    _webClient.OpenReadCompleted -= _webClient_OpenReadCompleted;
    try
    {
    if (!IsSpaceAvailable(e.Result.Length))
    {
    MessageBox.Show("There's not enough free space on your phone to store this song.");
    return;
    }

    var sw = new SongWriter();
    sw.WriteFileToIsoStoreFromHTTP(SONGNAME.mp3, e.Result);
    sw.SaveToMediaLibrary(SONGNAME.mp3);
    MessageBox.Show(SONGNAME.mp3 + " added to Library");
    }
    catch (Exception ex)
    {
    MessageBox.Show("Error Downloading: " + ex.Message);
    }
    }


    SongWriterClass :

    public SongWriter()
    { }

    public void WriteFileToIsoStoreFromHTTP(string songFileName, Stream songFileStream)
    {
    using (var fileStream = new IsolatedStorageFileStream(songFileName, FileMode.CreateNew, IsolatedStorageFile.GetUserStoreForApplication()))
    {
    byte[] buffer = new byte[1024];
    int bytesRead;
    uint totalBytesRead = 0;

    while ((bytesRead = songFileStream.Read(buffer, 0, buffer.Length)) != 0)
    {
    totalBytesRead += (uint)bytesRead;
    fileStream.Write(buffer, 0, bytesRead);
    }
    }
    songFileStream.Close();
    }

    public void SaveToMediaLibrary(string fileName)
    {
    var library = new MediaLibrary();
    {
    library.SaveSong(new Uri(fileName, UriKind.Relative), null, SaveSongOperation.MoveToLibrary);
    }
    }


    Quote Originally Posted by theothernt View Post
    Do you want to show some code on how you're downloading a file, moving it to the MediaLibrary then cleaning up?

    I'm sure there are many apps that do something similar yet I haven't heard reports of similar behaviour - and if it's an issue, it would be good to flag it with the Windows Phone team or post a work-around on the Nokia Wiki.
    Last edited by nsbabra; 2013-08-31 at 12:19.

Similar Threads

  1. How to use the 'C' (Clear) Key?
    By Gunblade in forum Mobile Java General
    Replies: 4
    Last Post: 2010-09-08, 18:01
  2. Not clear abt UID???
    By chandantheracer in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 10
    Last Post: 2010-08-26, 07:26
  3. Replies: 3
    Last Post: 2008-10-15, 05:54
  4. To Clear?
    By nandi1225 in forum Symbian
    Replies: 3
    Last Post: 2008-04-25, 07:46
  5. The Clear Key
    By stejoh-3 in forum Symbian User Interface
    Replies: 0
    Last Post: 2002-11-25, 05:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×