<img data-attachment-id="18676" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-apps/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-apps.jpg" data-orig-size="1733,1733" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"Getty Images/iStockphoto","camera":"","caption":"Vector concept in flat retro style","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"477914601","orientation":"0"}" data-image-title="Debug Headless Apps" data-image-description="<p>Vector concept in flat retro style</p> " data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-apps.jpg?w=300" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-apps.jpg?w=800" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-apps.jpg?w=800&h=800" alt="Debug Headless Apps" width="800" height="800" class="aligncenter size-full wp-image-18676" srcset="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-apps.jpg?w=800&h=800 800w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-apps.jpg?w=1600&h=1600 1600w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-apps.jpg?w=150&h=150 150w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-apps.jpg?w=300&h=300 300w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-apps.jpg?w=768&h=768 768w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-apps.jpg?w=1024&h=1024 1024w" sizes="(max-width: 800px) 100vw, 800px" />
Since the introduction of headless apps in BlackBerry OS 10.2.0, many of our fellow developers have built fantastic apps that run in the background. Thank you. However, there is one thing we all are anxiously waiting for – debugging those headless apps.
So far we have relied on QDebug()s and printfs. But if you haven’t guessed already from the title, let me say it again – headless app debugging is finally here with Momentics 2.1. Since this is the most anticipated enhancement to our developer tools, we made sure that it’s one of the easiest things to use in the IDE.
Without further ado, let’s have a look at how I just debugged a headless app today. First and foremost, add some break points in your headless project’s source code.
<img data-attachment-id="18672" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-1/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-1.png" data-orig-size="468,128" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="debug headless 1" data-image-description="" data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-1.png?w=300" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-1.png?w=468" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-1.png?w=800" alt="debug headless 1" class="aligncenter size-full wp-image-18672" srcset="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-1.png 468w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-1.png?w=150 150w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-1.png?w=300 300w" sizes="(max-width: 468px) 100vw, 468px" />
On the toolbar, in the Launch mode drop-down list, select Debug.<img data-attachment-id="18671" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-2/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-2.png" data-orig-size="468,28" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="debug headless 2" data-image-description="" data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-2.png?w=300" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-2.png?w=468" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-2.png?w=800" alt="debug headless 2" class="aligncenter size-full wp-image-18671" srcset="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-2.png 468w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-2.png?w=150 150w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-2.png?w=300 300w" sizes="(max-width: 468px) 100vw, 468px" /> In the Launch configuration drop-down list, select the UI part of your headless app.<img data-attachment-id="18670" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-3/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-3.png" data-orig-size="468,28" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="debug headless 3" data-image-description="" data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-3.png?w=300" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-3.png?w=468" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-3.png?w=800" alt="debug headless 3" class="aligncenter size-full wp-image-18670" srcset="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-3.png 468w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-3.png?w=150 150w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-3.png?w=300 300w" sizes="(max-width: 468px) 100vw, 468px" /> Click beside the launch configuration drop-down list.<img data-attachment-id="18669" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-4/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-4.png" data-orig-size="468,28" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="debug headless 4" data-image-description="" data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-4.png?w=300" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-4.png?w=468" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-4.png?w=800" alt="debug headless 4" class="aligncenter size-full wp-image-18669" srcset="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-4.png 468w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-4.png?w=150 150w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-4.png?w=300 300w" sizes="(max-width: 468px) 100vw, 468px" /> In the Edit Configuration dialog box, change the Entry-Point to the service part of your headless app.<img data-attachment-id="18668" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-5/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-5.png" data-orig-size="375,377" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="debug headless 5" data-image-description="" data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-5.png?w=298" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-5.png?w=375" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-5.png?w=800" alt="debug headless 5" class="aligncenter size-full wp-image-18668" srcset="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-5.png 375w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-5.png?w=150 150w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-5.png?w=298 298w" sizes="(max-width: 375px) 100vw, 375px" /> Click Apply and then click OK. In the Launch target drop-down list, select a device or simulator.<img data-attachment-id="18667" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-6/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-6.png" data-orig-size="468,28" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="debug headless 6" data-image-description="" data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-6.png?w=300" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-6.png?w=468" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-6.png?w=800" alt="debug headless 6" class="aligncenter size-full wp-image-18667" srcset="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-6.png 468w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-6.png?w=150 150w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-6.png?w=300 300w" sizes="(max-width: 468px) 100vw, 468px" /> Click<img data-attachment-id="18673" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-9/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-9.png" data-orig-size="15,15" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="debug headless 9" data-image-description="" data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-9.png?w=15" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-9.png?w=15" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-9.png?w=800" alt="debug headless 9" class="alignnone size-full wp-image-18673" /> to debug your headless app. <img data-attachment-id="18666" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-7/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-7.png" data-orig-size="468,28" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="debug headless 7" data-image-description="" data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-7.png?w=300" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-7.png?w=468" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-7.png?w=800" alt="debug headless 7" class="aligncenter size-full wp-image-18666" srcset="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-7.png 468w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-7.png?w=150 150w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-7.png?w=300 300w" sizes="(max-width: 468px) 100vw, 468px" /> 8. Voilà! The Momentics IDE changes to the Debug perspective, installs the app on your simulator or device, and starts the app under the control of the debugging tool. <img data-attachment-id="18665" data-permalink="http://devblog.blackberry.com/2014/08/debug-headless/debug-headless-8/" data-orig-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-8.png" data-orig-size="468,246" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="debug headless 8" data-image-description="" data-medium-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-8.png?w=300" data-large-file="/content/dam/devblog-blackberry-com/images/blogs/2014/08/debug-headless-8.png?w=468" src="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-8.png?w=800" alt="debug headless 8" class="aligncenter size-full wp-image-18665" srcset="http://rimdevblog.files.wordpress.com/2014/08/debug-headless-8.png 468w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-8.png?w=150 150w, http://rimdevblog.files.wordpress.com/2014/08/debug-headless-8.png?w=300 300w" sizes="(max-width: 468px) 100vw, 468px" /> The support for headless debugging completes the developer experience with headless apps, and I have no doubt that this will help us all design and build even better headless apps. Until next time, have a blast with this, and feel free to yell @ShadidHaque any time.