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 7711133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:17:56+00:00 2026-06-01T01:17:56+00:00

I am writing some code that can migrate some device persisted data to a

  • 0

I am writing some code that can migrate some device persisted data to a network server when the device/apps C2DM registration token changes.

This is ultimately kicked off by a broadcastreceiver (specifically a receiver called as the result of receiving a Google C2DM registration token)

@Override
public void onRegistered(Context context, String registrationId) throws IOException {
    Log.d(TAG, "registrationId: " + registrationId);
    Intent selectIntent = new Intent(this, AlertMigrationService.class);
    this.startService(selectIntent);
}

(Note: My app uses a custom application class that extends the normal Application class.)

I think technically this receiver could be called when my application is in the background (or not running) – so what happens when my intent service is started? Does it spool up my entire application and create an instance of my Application class?

Is it safe (or even a good idea) for me to call static methods on my Application class from inside the IntentService? (These static methods have return objects initialized in Application.onCreate)

  • 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-06-01T01:17:58+00:00Added an answer on June 1, 2026 at 1:17 am

    When your IntentService starts, it will create an instance of your Application class, if your application is not already running. If your application is alive, you will be able to access modified application-specific objects as they are. But if your application was killed and then the br starts the service , a new instance of the whole application is created. The static methods wont give you the values you desire at that time. Persist the data somewhere and don’t depend on the application lifecycle is what I suggest.

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

Sidebar

Related Questions

I am writing code that will migrate some data from one database to another,
I'm writing some code that handles logging xml data and I would like to
I was writing some code where I have a class that can accept mixins
I'm writing some code that makes an AJAX request to our web server. Our
I'm writing some code that uses a Tree (a regular tree that can have
Im running into this error that I can't work out Im writing some code
I'm writing some code to serialize some data to send it over the network.
I'm writing some code that id like to be able to work with any
I'm writing some code that uses dynamic shared libraries as plugins. My command line
I'm writing some code that has a lot of substitution. There's a list<char> productions

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.