<service android:name= ". Mypushorderservice " android:label=" @string/app_name " android:enabled=" true " > < Intent-filter> <!--received notification after processing service-- <action android:name= "com.lanshui.mobile.MYGETPUSH_ Order_action "/> </intent-filter> </service>
The above is the service configured in the configuration file
Startup code:
Start Service Processing Task Intent Intent = new Intent (); Intent.setaction ("Com.lanshui.mobile.MYGETPUSH_ORDER_ACTION"); Context.startservice (Intent);
But in 5.0, how to start not to get a half day, the result is as follows:
Remove configuration service from config file
The direct boot code is as follows:
Intent Intent = new Intent (context, mypushorderservice.class); Context.startservice (Intent);
That's enough.
######### #那么问题来了, 4.2.2 on the next test, this can not start service ...
No solution, simply the two ways to merge Ah ... The new code is as follows:
The first step is to add the registration configuration:
<service android:name= ". Mypushorderservice " android:enabled=" true " android:label=" @string/app_name " > < Intent-filter> <!--received notification after processing service-- <action android:name= "com.lanshui.mobile.MYGETPUSH_ Order_action "/> </intent-filter> </service>
The second mode of start-up:
Start Service Processing Task Intent Intent = new Intent (context, mypushorderservice.class); Intent.setaction ("Com.lanshui.mobile.MYGETPUSH_ORDER_ACTION"); Context.startservice (Intent);
This next ... Finish the test ah ... Both the 4.2.2 and the 5.0 tests can be run ...
There is a better way, please leave a message oh, continue to improve ...
About the inability to start service issues in Android5.0