Android-broadcast mechanism and service

Source: Internet
Author: User

Spent a few days, want to achieve positioning function, the use of Baidu's services, sometimes really very helpless, is a small problem, you can toss for several days.

First, I was positioned separately in the main thread (Fragment) and found that it didn't work.

Then I want to use the service and broadcast mechanism, in the service to start a new thread, but also a little reaction did not, for a long time, then I put the service and the main thread in the activity in the same package, it is OK.

I started thinking that the string type of action in intent was funny, but later found out the reason for the service name registered in Androidmanifest.xml, I started to set it to. Locationservice. Compare to use a global package. However, it is not noted that the service is not in the same package as the main activity.

So the service can be written in full.

Android-broadcast mechanism and service

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.