Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4000798
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:49:34+00:00 2026-05-20T07:49:34+00:00

For my app, I have about 15Mb (which can be compressed with some processing

  • 0

For my app, I have about 15Mb (which can be compressed with some processing power to about 5Mb) of audio+video+image data that I need to save to disk. For instance, I need to save this when user is interrupted with a phone call (because the activity might get killed after this) and when the user leaves the app.

I can save the data to SD card in about 10 seconds if I don’t compress it and something like 20 seconds if I do compress it, where I’d like it compressed. What options to I have for saving my data when onPause is called such that I can be sure the data has been saved?

From some basic experiments, my activity gets killed if onPause hasn’t finished after 5 seconds. Some ideas I’ve had:

  1. Starting a new Thread in onPause and saving the data there. This seems to work fine but seems like something I shouldn’t be doing.

  2. Starting a service, copying the data to the service somehow (would this be slow?) and then getting the service to save the data. I think this puts a notification icon at the top of the phone, but I don’t think it’s awful for a user to see the “Saving data…” task here.

  3. Can I put the data in a SQL database quickly and then save it later when the user returns to the app?

(Due to the nature of the app, there really isn’t any practical way I can save the data as I go because the user can transform the data in destructive ways with time consuming operations (e.g. 10 seconds for some operations). Even if I stored the original data and a list of the actions performed to recreate the data, the user would have to wait a minute or two when the app is next started up to process this.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:49:35+00:00Added an answer on May 20, 2026 at 7:49 am

    What options to I have for saving my data when onPause is called such that I can be sure the data has been saved?

    Technically, what you want is impossible. There are no guarantees after onPause().

    The best answer is what @Viktor Lannér suggested. To phrase it another way, don’t wait until onPause() to need to do 10-20 seconds of I/O. Devise some mechanism to allow you to save incrementally as the user performs operations, as a fallback mechanism if nothing else. This is akin to how a database maintains a transaction log.

    Starting a new Thread in onPause and saving the data there. This seems to work fine but seems like something I shouldn’t be doing.

    This is dangerous, because if the activity is closing (e.g., onDestroy() will be called momentarily), Android might terminate your process before your thread is completed.

    Starting a service, copying the data to the service somehow (would this be slow?) and then getting the service to save the data. I think this puts a notification icon at the top of the phone, but I don’t think it’s awful for a user to see the “Saving data…” task here.

    Make this be an IntentService, so it automatically shuts down when the work is complete. I wouldn’t “copy the data to the service”, but rather make the data centrally available, by a static data member if needed. This will not automatically put “a notification icon at the top of the phone”, and for something of this duration, that is probably not needed.

    Can I put the data in a SQL database quickly and then save it later when the user returns to the app?

    Flash I/O is not faster for a SQL database than for anything else.

    Due to the nature of the app, there really isn’t any practical way I can save the data as I go because the user can transform the data in destructive ways with time consuming operations (e.g. 10 seconds for some operations

    Then this probably isn’t designed for a mobile platform. Consider whether this app is an appropriate use of the technology.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

need ask you about some help. I have web app running in Net 2.0.
So I have about 10 short css files that I use with mvc app.
I'm writing an app in C# (.net 3.5) and I have a question about
This question is about App domains and Sessions. Is it possible to have IIS
I am just learning about app.config in respect of creating custom sections. I have
In my app have a window splitted by a QSplitter, and I need to
On my rails app I have a list of items (like a task list)
For my Django app I have Events, Ratings, and Users. Ratings are related to
In my app I have 2 divs, one with a long list of products
While developing my app I have come to realize that the majority of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.