I have a huge problem there, I am developing an application which starts after boot. It is easy to achieve by using BOOT_COMPLETED intent action, at least until Android 3.1, where all installed apps get "stopped" state (right?) and it has to be explicitly launched to register all BroadcastReceivers. I therefore added an activity to let my app launch (Since the rest is based on a service, no icon in launcher) for the first time and register receivers. The weird thing that happened is that on 2.2 it works perfectly, while on Android 4.0 and 4.1 (and I guess all above 3.1) I gets error "Unable to start service intent {...} not found". I think it's weird my cmp = smth/.service and not smth.service. Could You please explain me the difference in those systems related to this problem?
My manifest (application part, rest of it is not relevant):
<application android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<receiver android:name=".ReceiverCall" android:exported="false" android:enabled="true" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.intent.action.SCREEN_ON" />
<action android:name="android.intent.action.SCREEN_OFF" />
<action android:name="com.android.ondeath" />
</intent-filter>
</receiver>
<service android:name="TheService" android:label="@string/app_name" android:exported="false" android:enabled="true" />
<activity android:name=".Main"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
and also the receiver:
public class ReceiverCall extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(TheService.running() == false)
{
Log.d("Service", "ReceiverCall onReceive()");
context.startService(new Intent(context, TheService.class));
}
}
}
My activity just starts, has no layout, it runs onCreate which only has "finish()" within itself.
Thanks for any suggestions that could lead me to the right solution :)
@EDIT
I hope this is what You meant.
09-28 16:26:09.509: E/Trace(599): error opening trace file: No such file or directory (2)
09-28 16:26:09.639: I/ActivityThread(599): Pub com.android.calendar: com.android.providers.calendar.CalendarProvider2
09-28 16:26:09.869: D/ExchangeService(550): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false
09-28 16:26:09.929: D/dalvikvm(182): WAIT_FOR_CONCURRENT_GC blocked 0ms
09-28 16:26:10.140: D/dalvikvm(182): GC_EXPLICIT freed 544K, 13% free 11241K/12871K, paused 23ms+38ms, total 214ms
09-28 16:26:10.259: D/dalvikvm(615): Not late-enabling CheckJNI (already on)
09-28 16:26:10.289: I/ActivityManager(182): Start proc co.appdemo for broadcast co.appdemo/.ReceiverCall: pid=615 uid=10044 gids={3003, 1015, 1028}
09-28 16:26:10.629: E/Trace(615): error opening trace file: No such file or directory (2)
09-28 16:26:10.729: D/Service(615): running()
09-28 16:26:10.729: D/Service(615): ReceiverCall onReceive()
09-28 16:26:10.749: W/ActivityManager(182): Unable to start service Intent { cmp=co.appdemo/.TheService }: not found
09-28 16:26:11.079: D/dalvikvm(294): GREF has increased to 201