Need Suggestion to do a task when Android Boots-Up
<p>I have written an activity A, when users press a button, it will do MyConfig.doSomething() where MyConfig is simple class with activity A passed to it.</p>

<pre><code>public class A extends PreferenceActivity {
    private MyConfig mMyConfig;

    /* pseudo code, when button clicked, call */        
    mMyConfig.doSomething();
}
</code></pre>

<p>In mMyConfig, it accesses SharedPreferences for some configuration. Thus, I can do this to pass the activity to mMyConfig for calling getSharedPreferences().</p>

<pre><code>mMyConfig = new MyConfig ( this );
</code></pre>

<p>Here comes my request:</p>

<p>I want to do something that <code>MyConfig.doSomething()</code> already does, but except when users click some button to invoke it, I want to invoke it when Android Boots-Up.</p>

<p>I can write another class to extend BroadcastReceiver and then starts activity A by calling <code>startActivity(A.class)</code>, and then in A, do some tricks to make <code>mMyConfig.doSomething()</code> happen. It works but the Application will be shown on screen when Android Boots-Up.</p>

<p>I want to make <code>mMyConfig.doSomething()</code> happen implicitly without letting users be aware of it. I suppose two possible solutions but I don't know how to do it.</p>

<p>Solution A:
Write a class that extends BroadcastReceiver, start a service (instead of activity A) that reads the SharedPreferences of A and create MyConfig object to do <code>doSomething()</code>. However, I don't if this can work if activity itself is never launched and how could I do this (read SharedPreferences from a service)?</p>

<p>Solution B:
Write a class that extends BroadcastReceiver, start activity A without showing it, put it to activity stack by calling <code>startActivity(A.class)</code> in onReceive. Is this possible?</p>
