Android BLE connection CC2541 development record

Source: Internet
Author: User

1. The problem now encountered, the phone into hibernation after the wake, the app software and CC2541 communication is not normal, but CC2541 still detect when the connection state. How to solve this problem? Will the activity be recreated after the phone wakes up?

2.Wakelock lock Mechanism:
Applications can vote on whether the system is standby by applying the Wakelock lock mechanism, and when any application has applied for a wakelock lock, it is not released during standby and the system will not enter standby until all of the application's Wakelock locks are released, before they enter standby. Can this lock be used this time? Let the system not standby, if not standby, more power? If there is QQ open, the system is originally standby?

3. Look at the code of the lock

1  /**        2 * Get the Power lock, keep it running when the service is still getting the CPU when the screen is off3   */4  Private voidAcquirewakelock () {5   if(NULL==WakeLock) {6PowerManager pm =(PowerManager) Getsystemservice (context.power_service);7WakeLock =Pm.newwakelock (Powermanager.partial_wake_lock8|Powermanager.on_after_release, GetClass ()9 . Getcanonicalname ());Ten    if(NULL!=WakeLock) { OneLOG.I (TAG,"Call Acquirewakelock"); A Wakelock.acquire (); -    } -   } the  } -  -  //release the device power lock -  Private voidReleasewakelock () { +   if(NULL! = WakeLock &&Wakelock.isheld ()) { -LOG.I (TAG,"Call Releasewakelock"); + wakelock.release (); AWakeLock =NULL; at   } -}

4. Will the activity be recreated after waking? When you rotate the screen, you

Android BLE connection CC2541 development record

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.