以下是我的啓動服務的代碼。Android4.0服務已啓動
public class MyStartupIntentReceiver extends BroadcastReceiver
{
public void onReceive(Context context, Intent intent)
{
Intent callService = new Intent();
callService.setAction("com.xxxx.yyyy.services.StartServiceActivity");
context.startService(callService);
}
}
在manifest文件中,我定義瞭如下的廣播接收器。
<receiver android:name=".MyStartupIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"
/>
</intent-filter>
</receiver>
進出口申報業務一樣。一旦用戶從我的活動開始了我的應用即時通訊開始服務清單文件
<service android:name=".services.CallService">
<intent-filter>
<action
android:name="com.xxxx.yyyy.services.StartServiceActivity" />
</intent-filter>
</service>
以下
serviceIntent = new Intent(SplashScreen.this, StartServiceActivity.class);
getApplicationContext().startService(serviceIntent);
問題是服務工作的罰款與android2。 3.5 SDK設備。但不適用於4.0設備。我的代碼有任何問題。請幫我解決。