How Android Bluetooth 4.0 ble low-power applications have been developed over the past few months

Source: Internet
Author: User
Let's talk about how Android Bluetooth 4.0 ble low-power applications have been developed over the past few months. The time for this blog is, and the time for later updates is also indicated. I began to look forward to the various features of Bluetooth 4.0 and the beautiful depiction of various application scenarios. However, the desire is beautiful, and the reality is very backbone. In the past few months, we have suffered many setbacks and pains. It is quite difficult. android2.3 does not have ble APIs, and android4.0 has an hdp api, after the new xt910 system is refreshed to 4.0, the system still cannot be connected. If you want to brush it back, the mobile phone will be suspended. You can only pay for the new xt910. You can find the open-source SDK of botnet, but you cannot use the add-on function on your mobile phone. After multiple searches, you can find the Motorola SDK, it took more than a month to connect to the Bluetooth 4.0 device for the first time. However, the example program in the development kit is a chicken tendon. There are many problems that need to be optimized before they can be used, after more than a month, I finally made a simple application product that is barely usable. Although several applications have been developed, the Bluetooth 4.0 is unstable, the microcontroller hardware is unstable, and the underlying mobile phone API is unstable, in particular, android can only be used in Motorola blade series 2.3, and upgrades to 4.0 are unavailable, so Motorola's sales volume is not big, some people have been laid off to gain a larger market share in the past few months. Especially in China, the market share will only get smaller and smaller, and people will gradually be forgotten, I even sold the brand again, so the boss was reluctant to invest in development. I had to wait for Samsung's mature development kit to come out and do it again. Currently, there are only a few mobile phones with the Bluetooth 4.0 feature, including Motorola's blade series, htc1x, and Samsung GS3, although htc1x and Samsung GS3 have Bluetooth 4.0 hardware devices, but they are not mature enough to develop related sdks. The open-source Broadcom ble SDK is not available on mobile phones. Samsung GS3 is the most popular Android Bluetooth product in the market. However, the Bluetooth function of the system cannot be found on any device searching for Ble, let alone the connection, I have been paying attention to this for a few months and only some scattered materials. some cool people have integrated some frameworks, but root users are required to use them. This is the same as Apple's jailbreak, many of the people who buy GS3 phones won't be root except developers, because they lose the warranty service as a root user. Recently, I have seen some hopes that some people can use Samsung's Development Kit to find all the applications for Bluetooth devices, but it is not certain whether they can be used without a real machine test.

 

The iPhone version can only be used by mobile phones of iPhone 4S or above, but there is also a verification bug after ios5 is upgraded to the ios6 system. As a result, the mobile app cannot issue command data to the bluetooth device, therefore, ble applications that require interaction cannot be used. The default iOS 6 System of iPhone 5 cannot be used, and the power consumption is much larger than that of iOS 5. You can only wait for Apple to upgrade the system, however, the upgrade date for Apple should not be too long due to its large closed source and development investment. It should be able to be solved in a few months. (Note later: as expected, ios6.0.1 will soon be released to solve WiFi connection and other problems, and ios6.1bate will be released at the same time)

 

Android is a pain point, and various manufacturers have customized them differently. There are also differences in the versions of each system, which is difficult to guarantee compatibility and the screen size varies greatly, developing widely used applications wastes a lot of effort on compatibility. applications developed based on different sdks provided by different vendors can only adapt to a certain type of mobile phones, different vendors are basically incompatible with redevelopment.

In addition, the Bluetooth of the iPhone cannot communicate with the Bluetooth of the Android phone, and other versions of the iPhone, except Bluetooth 4.0, must pass Apple's authentication before they can be used, it is impossible for large manufacturers to pass authentication in mass production. Of course, you can add an authentication chip to solve the problem. Therefore, many small companies, solution companies can only use Bluetooth 4.0 for iPhone applications, while Android does not have this restriction.

 

In addition, we found that some people made products for health applications, but they did not use the Bluetooth 4.0 spp protocol for low power consumption, the power consumption of Bluetooth 2.1 or 3.0 is a big problem. For some small peripherals, the use of button batteries cannot be used, for some creative products, frequent battery change or charging will greatly compromise the user experience and greatly increase the cost.

Compared with the Wi-Fi and ZigBee Wireless Solutions, the cost of the Bluetooth and Wireless RF Modules nrf24l01 is much lower. The advantage of wifi is that it is easier to achieve remote control, with a long distance and relatively stable signal.

 

Additional content:

After continuous efforts, Samsung's support for Ble, htc1x, And Moto can be developed for mainstream Bluetooth Android 4.0, but it is estimated that Samsung's sales volume will only be large in the future, the underlying layers of different vendors are quite different.

In addition, ios6.0 can take the iPhone as a slave device. Two iPhones can transmit data through Bluetooth communication, which is a bit similar to the SPP protocol, but Android Bluetooth 4.0 does not see related APIs.

Now, Google Nexus 4 from LG supports ble Bluetooth 4.0, but there are no corresponding APIs and sdks. Xiaomi 2 also supports ble Bluetooth 4.0, because Xiaomi's Rom is an open-source research, it is easy to estimate, but if the number of users is too small, there is no need to focus on it.

The development of BLE is fast and changing. Many of the previously added websites cannot be accessed, updated or voided.

-------------------------------------------------------------------------

Supplement 2:

Http://processors.wiki.ti.com/index.php/Category:BluetoothLE
This is an article on TI's wiki with the example programs of Moto and HTC, but the support is not comprehensive.
Motorazrandroidbledemo obsolete. Updated Motorola ble SDK with new API is not compatible.
Htc1x ble API-complete ble API for htc1x (European version only !) New!

Now it is changed to the following:
Motorazrandroidbledemo obsolete. Updated Motorola ble SDK with new API is not compatible.
Htc1x ble API-complete ble API for htc1x (European version only !) Obsolete. Updated Android SDK is not 100% compatible.

Samsung 4.0.4 can search for ble devices, but the connection is faulty. You need to upgrade to android4.1.1.

Nordic released two versions of NRF apps on Google Play (the heart rate meter and anti-Throttling are in one application), one for Motorola and one for Samsung GS3. You can download the decompilation reference.

Please do not ask me how to download the APK, how to decompile it, and how to use it. Direct download and connection may not be successful for Nordic products, my xt910 and GS3 mobile phones have never been connected to the Bluetooth 4.0 product developed by csr1000. I heard that Ti can be connected directly, but I cannot read the data.

However, because he is not confused, the writing method is worth reference.Connect Samsung Galaxy S3 and Samsung Note 2 App:

Https://play.google.com/store/apps/details? Id = com. Nordic. nordicbleapp & feature = search_result #? T = w251bgwsmswyldesimnvbs5ub3jkawmubm9yzgljymxlyxbwil0.

The NRF utility app is a tool to demonstrate Bluetooth Smart connection to Samsung Galaxy S3. the app enables you to connect to different Bluetooth Smart accessories such as wireless heart rate monitors and proximity tags. this app complements Nordic semicondu's nrf8000 and nrf518 series Bluetooth Smart solutions, compatible with Bluetooth v4.0.

Bluetooth Smart support:
-Heart rate monitor
-Proximity tag

Note:
Samsung Galaxy S3 and Samsung Note 2 are currently supported handsets.
Miminum supported Android version is jelly bean

What kind of Rate Card SDK does Motorola currently have access:

Http://www.motorola.com/sites/motodev/library/bluetooth_apis.html

------------------------------------------------------------------------------

Open Bluetooth Low Energy API
Http://android-btle.github.com/framework/
This is an open-source API of Broadcom that requires root permissions. users need to add relevant files to the mobile phone system like adding-on of Google Maps in lite Rom, in addition to root, the requirements for users are also relatively high.

Samsung Galaxy S3 4.1.1 has many underlying ble API problems recently. The Bluetooth hardware is unstable. If you disable Bluetooth in the system settings after the connection fails, the phone will often restart, restarting Bluetooth with code delay is almost always caused by the restart of the mobile phone. In this case, when the connection is abnormal, it is not recommended, various latency processing is required to avoid exceptions and restart of the mobile phone, resulting in slow and helpless automatic connection latency, and the underlying layer cannot be fully controlled. Although Motorola has many problems, TI's Bluetooth hardware is still more stable. You can use the code to restart Bluetooth to solve various exceptions. However, the amount of code and code is much more complicated than Samsung's.

Motorola's ble SDK supports devices in non-secure mode. GS3 does not support the SDK. In non-secure mode, bond cannot be connected.

======================================

Supplement

Recently, many people have asked me for code and development. Here, it is explained that the development of BLE app requires cooperation with Bluetooth engineers. The underlying communication of each chip manufacturer may be different, the results of different SDK versions of the same chip are also different. At present, the solutions are mostly Ti chips. I am working on CSR, and some people use Nordic, for other brands such as Broadcom, devices that use the app that Ti can use to switch to CSR may not be able to use. The same anti-loss device may be different for each company's bluetooth module, eventually, products that may only match their own Bluetooth modules will be used. I have limited time and energy, and cannot provide FREE DEMO code and technical support based on the factors of business competition.

Supplement on February 1

Now we have developed several ble applications for Samsung Galaxy S3 (which need to be upgraded to android4.1.1) (Anti-drop, heart rate meter, pedometer, weight scale, smart watch, smart lamp holder ), normally, no problem is found, but Samsung GS3 mobile phone will be stuck after discovercharacteristics, resulting in the false state of the mobile phone and other operations cannot be performed, even though asynchronous service is also used during connection, this is often the case when other non-Bluetooth apps are used. It seems that the underlying system of the mobile phone is faulty, and the advantages of quad-core multithreading are not fully utilized. Automatic Restart of code exceptions is the same or more frequent as xt910.

Supplement

Samsung finally opened a ble column, but soon it was abandoned. It was estimated that there were too many problems to announce.

Http://developer.samsung.com/ble

[Samsung ble SDK] Samsung BleSdks 2.0 Beta

Samsung developers ble

This blog can be searched for keywords such as Baidu search for Bluetooth 4.0 development, Android Bluetooth 4.0 development, Android Bluetooth 4.0 development, and Android ble. Many people have joined the QQ Group to discuss this blog.

Supplement

I recently talked with my friends about the differences between APIs and android4.1.1 after GS3 is upgraded to android4.1.2. For example, it will not be automatically connected several times after the connection is disconnected. In addition, there are some differences between the underlying layer of note2 and GS3, and some bugs are different. There are also many problems. It is estimated that the development of GS3 cannot run well on note2, and this compatibility is quite annoying, iOS development is much easier to document.

2012-03-12 supplement

Today, I tried GS3 to use 4.0.4 or connect to send and receive data. It can be developed based on 4.1.1 to be compatible with other system versions.

Many people in Ti will pop up a pairing prompt box, And the Bluetooth side is set to a non-secure connection, so there is no way to achieve automatic connection, and many functions cannot be implemented. I have never used CSR, but it won't pop up on iOS. The underlying processing methods for iOS and Android are different. Recently, we have found that more and more people are working on ble. We may have time to sort out a specific article on development.

Two pictures of Samsung ble API were uploaded:

 

 

Supplement

A recent test showed that NFC seriously affected ble usage. After trying for several times, NFC affected 100%, and restarting Bluetooth also caused the mobile phone to automatically restart.

Android's ble Bluetooth is too limited to be used with Wi-Fi NFC at the same time. This should be noted in the product description. Otherwise, users will not know what is going on.

Bluetooth may conflict with WiFi and NFC. advised to turn off WiFi and NFC.

========================================================== ====================

Supplement

Recently, some people in the group said that the GATT protocol has never been understood. For more information about the Protocol suggestions, see the official documentation. Here we will briefly introduce the following ideas:

Three Layers of GATT services --> characteristic --> handle are all identified by UUID. One device can register multiple services, one service can have multiple characteristic, and one characteristic can have multiple handle.
During data communication, you need to find the handle defined by the bluetooth device. The underlying layers of Samsung and IoS are encapsulated with the handle layer, which does not need to be processed by applications. You only need to obtain the corresponding characteristic layer, moto needs to get the specified handle before it can be used. I have published a few more to Google Play on the app, like tossing can decompile look at the https://play.google.com/store/apps/details? Id = com. cyberblue. ble01 & feature = search_result https://play.google.com/store/apps/details? Id = com. cyberblue. iiwatch & feature = search_result #? T = w251bgwsmswyldesimnvbs5jewjlcmjsdwuuawl3yxrjacjd https://play.google.com/store/apps/details? Id = com. cyberblue. ble07 & feature = search_result #? T = w251bgwsmswxldesimnvbs5jewjlcmjsdwuuymxlmdcixq .. https://play.google.com/store/apps/details? Id = com. cyberblue. ble10 & feature = more_from_developer #? T = w251bgwsmswxldewmiwiy29tlmn5ymvyymx1zs5ibguxmcjd 2013-04-25 supplement

Http://developer.samsung.com/ble
Samsung released the ble API, which is different from the original class.
It is estimated that the system can only be used when it is upgraded to 4.2. After it is upgraded to 4.2, it is estimated that the API development based on Decompilation will not be used. compatibility is a headache.

================================================== Android will support Bluetooth Smart ready
Http://www.beareyes.com.cn/html/2013/05/16/news/79112.shtml
At the annual meeting of Google I/O developers, Google announced that its Android operating system will support Bluetooth Smart ready and Bluetooth Smart devices in the next few months.
Mobile phones and tablets using the new Android system are equipped with dual-mode bluetooth chips, which belong to the Bluetooth Smart ready specification. Bluetooth Smart ready is an advanced standard for Bluetooth technology and can be compatible with almost all electronic products that support Bluetooth technology, including keyboards, headphones, and the next generation Bluetooth Smart Application accessories (Bluetooth Smart appcessory), such as Fitbit flex smart wristbands and Pebble smart watches.

Android technology exchange QQ group (253065556)

Related Article

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.