IntentService onCreate() called but onHandleIntent() not
<p>I'm starting an <code>IntentService</code> with the following method:</p>

<pre><code>private void startMyService(Data data) {
    Intent intent = new Intent(this, MyService.class);
    intent.putExtra(KEY_DATA, data.toJson());
    startService(intent);
}
</code></pre>

<p>The <code>Data</code> class:</p>

<pre><code>public class Data extends ArrayList&lt;MyObject&gt; {

    public Data() {
        super();
    }

    public Data(Collection&lt;MyObject&gt; myObjects) {
        super(myObjects);
    }

    public String toJson() {
        return new Gson().toJson(this);
    }

    public static Data fromJson(String jsonString) {
        return new Gson().fromJson(jsonString, Data.class);
    }
}
</code></pre>

<p>The relevant part of the <code>IntentService</code>:</p>

<pre><code>public class MyService extends IntentService {

    private Data data;

    public MyService() {
        super("myServiceName");
    }

    @Override
    public void onCreate() {
        super.onCreate();

        // this gets called properly
        Log.d("myTag", "Service onCreate()");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        // this is not called in case of the bigger dataset
        Log.d("myTag", "Service onHandleIntent()");

        String dataJson = intent.getStringExtra(KEY_DATA);
        data = Data.fromJson(dataJson);

        // doing stuff with data
    }
}
</code></pre>

<p>I have 2 test scenarios:</p>

<ul>
<li>Data holds 2000 objects</li>
<li>Data holds 4000 objects</li>
</ul>

<p>With 2000 objects, the <code>Service</code> runs flawlessly.</p>

<p>With 4000 objects, the <code>onCreate()</code> method of the <code>Service</code> is called and that's it... <code>onHandleIntent()</code> is not called. The app just throws an ANR after a while.</p>

<p>I've tested with both <code>Log.d()</code> calls and breakpoints on the first line of <code>onHandleIntent()</code>, it is not called at all when <code>Data</code> holds 4000 objects.</p>

<p><code>TransactionTooLargeException</code> is <strong>not</strong> thrown.</p>

<p>I get no <code>Exception</code>s thrown at all, no idea what's wrong.</p>

<p>What could be the cause of this behaviour?</p>