<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Android: Sending data &amp;gt;20 bytes by BLE</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/28388/android-sending-data-20-bytes-by-ble</link><description>I am able to send data upto 20 bytes by connecting to an external BLE device. How do I send data greater than 20 bytes. I have read that we have to either fragment the data or split characteristic to required parts. If I assume my data is 32 bytes, could</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Thu, 04 Jan 2018 07:12:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/28388/android-sending-data-20-bytes-by-ble" /><item><title>RE: Android: Sending data &gt;20 bytes by BLE</title><link>https://test-devzone.nordicsemi.com/thread/111962?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2018 07:12:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ef86ce8-a7aa-44de-b6f9-c0d868f69209</guid><dc:creator>user67282</dc:creator><description>&lt;p&gt;Hey can I get this working for iOS..??, I&amp;#39;m able to send data to BLE but on Serial printer it shows the partial data only.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android: Sending data &gt;20 bytes by BLE</title><link>https://test-devzone.nordicsemi.com/thread/111960?ContentTypeID=1</link><pubDate>Tue, 17 May 2016 21:02:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af1f21d2-1111-4ec0-9c1a-f76421d8a7ee</guid><dc:creator>user7418</dc:creator><description>&lt;p&gt;The &lt;a href="https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#requestMtu(int)"&gt;requestMtu&lt;/a&gt; method has been added in the Android API 21. @hungbui could you please confirm if any SoftDevice support larger MTU (the &lt;code&gt;ATT_OP_MTU_REQ&lt;/code&gt; opcode 0x02 according to the spec) ?&lt;/p&gt;
&lt;p&gt;According to &lt;a href="https://github.com/NordicSemiconductor/Android-nRF-Toolbox/commit/341ecf5781f9e8ba5b979d5b6c94a2683bdfb304#commitcomment-17511946"&gt;this commit&lt;/a&gt; of the Android-nRF-Toolbox project, long writes are supported by the Android BLE stack if the write type is set to &lt;code&gt;WRITE_TYPE_DEFAULT&lt;/code&gt; (ATT write request).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android: Sending data &gt;20 bytes by BLE</title><link>https://test-devzone.nordicsemi.com/thread/111961?ContentTypeID=1</link><pubDate>Wed, 18 Jun 2014 10:15:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41769dab-aab3-426b-8056-f1f7231213bd</guid><dc:creator>user4172</dc:creator><description>&lt;p&gt;I got this working finally. onCharacterisiticWrite() was important but if we only write and don&amp;#39;t read from the firmware, then writing is a very fast process and after implementing this too I only get the last part. The trick for this is &lt;code&gt;Thread.sleep(150)&lt;/code&gt;. Delay the process by 150 milliseconds and it works! Thanks for the guidance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android: Sending data &gt;20 bytes by BLE</title><link>https://test-devzone.nordicsemi.com/thread/111959?ContentTypeID=1</link><pubDate>Wed, 18 Jun 2014 09:11:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46d23601-a4da-41e7-8b1d-94ff72ad1272</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Ankit,
Seems that on Android long write is not supported, you would need to split your large data in to chunks of 20 bytes packet.&lt;/p&gt;
&lt;p&gt;You would need to make sure the packet is queued correctly before you send the next packet. First you have to check for the return code of BluetoothGatt.&lt;a href="https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic)"&gt;writeCharacteristic()&lt;/a&gt;. Second you would need to wait for the call back BluetoothGattCallback: &lt;a href="https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback.html"&gt;onCharacteristicWrite()&lt;/a&gt; before you queue the next packet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>