Reputation: 400
I have an android app service for pushing notification which run in the background. It invokes the intent using startService(); It works fine in pre-versions but it does not work on lollipop. I am not aware of Why it is not works (Because service intents must be explicit in lollipop) but when i" trying to make it explecit background service not works.How to resolve it.
Here is part of working code to invoke service:
MainActivity
Intent serviceIntent = new Intent("android.intent.action.START_SERVICE");
this.startService(serviceIntent);
Manifest
<service android:name=".MyService">
<intent-filter>
<action android:name="android.intent.action.START_SERVICE" />
</intent-filter>
</service>
Upvotes: 0
Views: 1120
Reputation: 415
Set your packageName i think its work.
intent.setPackage(this.getPackageName());
Upvotes: 0