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