About the inability to start service issues in Android5.0

Source: Internet
Author: User

<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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.