<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alistair Sykes on Medium]]></title>
        <description><![CDATA[Stories by Alistair Sykes on Medium]]></description>
        <link>https://medium.com/@alistairsykes?source=rss-814f06d30881------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*Y1XTNifTosT_te2kgcVsOQ.jpeg</url>
            <title>Stories by Alistair Sykes on Medium</title>
            <link>https://medium.com/@alistairsykes?source=rss-814f06d30881------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 07:39:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alistairsykes/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Your Android XR strategy: An evolution, not a revolution]]></title>
            <link>https://alistairsykes.medium.com/your-android-xr-strategy-an-evolution-not-a-revolution-7f96c1e422e1?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f96c1e422e1</guid>
            <category><![CDATA[product-strategy]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[xr]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-xr]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Thu, 04 Sep 2025 08:26:50 GMT</pubDate>
            <atom:updated>2025-09-04T08:26:50.878Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*P2_N0eawD49G6Svu.png" /></figure><p>How to take a pragmatic path to XR for your Android app</p><p>Let’s be honest. When we hear about “<a href="https://www.meta.com/en-gb/metaverse/">The Metaverse</a>” or “XR”, our minds often jump to complex, headset-exclusive games. For those of us building and maintaining e-commerce, travel, productivity or other apps, this can feel distant and irrelevant; a costly distraction from our core business.</p><p>I am going to offer a different perspective. For most <a href="https://developer.android.com/topic/architecture/intro">modern Android applications</a>, the path to becoming “XR-ready” is not a revolutionary rewrite. It’s a simple, logical evolution of the best practices we have already been adopting. If you have invested in building a great <a href="https://developer.android.com/guide/topics/large-screens">large-screen experience</a> for your app, you are already most of the way there.</p><h3>Your head start: Why large screen optimisation is 90% of the battle</h3><p>Think about what it means to <a href="https://developer.android.com/docs/quality-guidelines/large-screen-app-quality">optimise and differentiate</a> an app for tablets and foldables; you will have already stopped making assumptions. Your UI is no longer a static, 360dp-wide canvas. It reflows, adapts, and uses panels and component-based layouts to make intelligent use of the space.</p><figure><img alt="Concept visual of Android XR from android.com" src="https://cdn-images-1.medium.com/max/600/0*j0NLcmPh_pCRRZCy" /><figcaption>Source: android.com, <a href="https://lh3.googleusercontent.com/joKQBmZN0XcPa3bq280151MiYSSX-5rR4T3QRWUtGjhI6S5eW2GHoMvWIh5uVGE-v5HB7AEjQds6DoT4Drfz-6XLr4naBumKQFqik3QPXLVlS4L2vOs=w600-rwa-e366-v1">link</a></figcaption></figure><p>Now, think of an XR environment. At its simplest, it is an <a href="https://www.android.com/xr/">infinite canvas</a>. An operating system in XR can present apps as 2D windows, or “panels,” floating in a 3D space. An app that knows how to adapt its layout from a phone to a tablet has already solved the core logical puzzle of how to exist in this new context. It has proven it is not tied to a single aspect ratio or screen size.</p><p>This is the first, and most crucial, step: <strong>compatibility</strong>. Your well-architected app can simply <em>exist</em> in an XR world with little to no code changes. Ensuring your service is not left behind as new hardware emerges.</p><h3>From compatibility to optimised</h3><figure><img alt="Concept of Android XR depicting a menu and 2 frames" src="https://cdn-images-1.medium.com/max/1024/0*I0msjG_aoyEoTTcG" /><figcaption>Source developer.android.com, <a href="https://developer.android.com/static/images/develop/xr/jetpack-xr-sdk/material-design/navigation-rail-spatial.jpg">link</a></figcaption></figure><p>Having an app that works is one thing. Having one that feels good to use is another. Once your app is compatible, the next step is to optimise its behaviour for the new paradigms of XR. This is less about adding new features and more about being a good citizen in this new environment.</p><p>The great news? If your codebase is using the <a href="https://developer.android.com/develop/ui/compose/designsystems/material3">Google Material3 UI library</a>, lots of this work is done for you. Hover states, multimodal input handling and spatial dialogs come as standard.</p><p>To enable this behaviour, simply wrap your compose hierarchy in <a href="https://developer.android.com/reference/kotlin/androidx/xr/compose/material3/package-summary?_gl=1*1dd6lv0*_up*MQ..*_ga*MTk2NTUwMDQyMy4xNzUxMjcxNjMy*_ga_6HH9YJMN9M*czE3NTEyNzE2MzIkbzEkZzAkdDE3NTEyNzE2MzIkajYwJGwwJGgyMTE3Mzk4MjM.#EnableXrComponentOverrides(androidx.xr.compose.material3.XrComponentOverrideEnabler,kotlin.Function0)">EnableXrComponentOverrides</a>.</p><p>After enabling XR behaviours in Material3, review your app against the <a href="https://developer.android.com/design/ui/xr/guides/get-started">XR guidelines</a>. Add the ability to move into “ <a href="https://developer.android.com/design/ui/xr/guides/foundations?_gl=1*1m0hbkt*_up*MQ..*_ga*MTk4ODcwMTQ4MS4xNzUxODk2NDE4*_ga_6HH9YJMN9M*czE3NTE4OTY0MTckbzEkZzAkdDE3NTE4OTY0MTckajYwJGwwJGgyOTA4MTU2NTY.#modes">full space</a>”. Look for opportunities to move content into <a href="https://developer.android.com/design/ui/xr/guides/spatial-ui?_gl=1*1m0hbkt*_up*MQ..*_ga*MTk4ODcwMTQ4MS4xNzUxODk2NDE4*_ga_6HH9YJMN9M*czE3NTE4OTY0MTckbzEkZzAkdDE3NTE4OTY0MTckajYwJGwwJGgyOTA4MTU2NTY.#spatial-panels">panels</a>. Add panel user controls for resizing and moving. These will provide an optimised experience for your users.</p><h3>From optimised to enrichment</h3><p>Once your app feels at home as a 2D panel, you can begin to add moments of true <strong>enrichment</strong>. This is not about rebuilding your app in 3D. It is about adding discrete, high-value features that leverage the unique capabilities of XR.</p><figure><img alt="Concept of XR glasses and visually placing a sofa" src="https://cdn-images-1.medium.com/max/1024/0*o0J7oMmQfxtzta0D" /></figure><ul><li><strong>For an E-commerce App</strong>: You have a product details page. Next to the image carousel, you add a “View in your space” button. Tapping this opens a contained ARCore-powered view that lets the user place a true-to-scale 3D model of that sofa in their own living room. The core e-commerce experience remains. But now the purchase decision is supported by a powerful, confidence-building tool. The user can see in the nearest to “real” way the result of their potential purchase.</li></ul><figure><img alt="XR headset cencept of viewing a hotel room" src="https://cdn-images-1.medium.com/max/1024/0*4L-HyYapvZQbnAee" /></figure><ul><li><strong>For a Travel App</strong>: A user is looking at a hotel page. Alongside the photos, there is a “Take a virtual tour” button. This places the user in the room or allows them to walk around the hotel. This provides a much richer sense of place than a flat image gallery. The hotel and room are becoming “real” and are already making the user feel.</li></ul><p>Get creative with the kinds of experiences you can offer. Ideate with your product and design teams. Do what you do best and come up with some great user experiences.</p><p>Begin to gather assets and content for this new world now. Are there any <a href="https://mapsplatform.google.com/intl/en_uk/solutions/visualize-data/">geospatial maps</a> you could create? Any 3D models of products? <a href="https://developer.android.com/design/ui/xr/guides/environments">Spatial audio</a> clips of significant locations? To enable these rich experiences, you will likely need assets. Whether gathered, created or purchased, acquiring these could unlock some amazing use cases.</p><h3>Strategy for legacy apps</h3><p>What if you have an app which has not been updated to support large screens? It still uses older and even deprecated patterns. For teams in this position, my advice is direct: your most valuable XR strategy today has nothing to do with XR. Your focus should be on <strong>modernisation</strong>.</p><p>Trying to bolt XR features onto a legacy codebase that is not responsive or architecturally flexible is like trying to install a state-of-the-art home cinema in a house with crumbling foundations. The project will be challenging, the costs might spiral, and the result could disappoint or even frustrate your users.</p><p>The effort you spend adapting to large screens and moving to modern, testable architecture will deliver immediate value to your existing user base. It will improve stability, performance, and your team’s development speed. As a crucial side effect, it will also give you a solid foundation upon which you can build a meaningful XR experience when the time is right. Modernisation is not a detour from your XR journey; it is the first, essential leg of the trip.</p><h3>It is about evolution, not revolution</h3><p>The barrier to entry for XR is not as high as you might think. It does not demand that we all become expert game developers in <a href="https://unity.com/">Unity</a>. For the vast majority of “normal” apps, the path is an incremental one.</p><ul><li><strong>First, focus on solid fundamentals</strong>. Build a responsive, adaptive UI that shines on large screens. This gives you basic XR compatibility with minimal extra cost.</li><li><strong>Next, optimise that experience</strong>. Lean into the spatial UI experience. Offer full space mode and spatial panels.</li><li><strong>Finally, identify a single, high-impact enrichment</strong>. Find one moment in your user journey that could be meaningfully improved with a dash of XR.</li></ul><p>By treating XR as an evolutionary step, we can protect our apps’ future relevance. We can delight our users without betting the company on a new and unproven platform. Look at your app today. If you have invested in a great responsive UI, you are already on the launchpad. 3, 2, 1 …</p><p><em>A previous post</em></p><p><a href="https://alistairsykes.medium.com/how-to-trust-all-ssl-certificates-with-kmm-and-ktor-8f686aec0d09">How to trust all SSL certificates with KMM and Ktor</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*V6S7djFRun4-0w23.png" /></figure><p>Originally published at <a href="https://www.brightec.co.uk/blog/your-android-xr-strategy-an-evolution-not-a-revolution">brightec.co.uk</a>. For more content check out the <a href="https://www.brightec.co.uk/blog">brightec blog</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f96c1e422e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to trust all SSL certificates with KMM and Ktor]]></title>
            <link>https://alistairsykes.medium.com/how-to-trust-all-ssl-certificates-with-kmm-and-ktor-8f686aec0d09?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f686aec0d09</guid>
            <category><![CDATA[kmm]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ktor]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Wed, 22 Mar 2023 14:06:53 GMT</pubDate>
            <atom:updated>2023-10-19T09:01:45.182Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXHHzNCKFXIPFaAHrv-Xdw.jpeg" /></figure><p><strong>Warning — Trusting all certificates is dangerous. It means you cannot trust that the server is who you think it is.</strong></p><h3>Why</h3><p>Often API test environments are not signed with a certificate authority backed certificate. This is to save time and avoid expiring certificates. By default, mobile applications will not allow communication with such servers.</p><p>When developing mobile applications it can be necessary to communicate with such APIs. Again I stress this can be dangerous and precautions should be taken. For example, by using isolated devices which cannot access any real data.</p><h3>Project Setup</h3><p>For this post, I am assuming a standard/template <a href="https://kotlinlang.org/lp/mobile/">Kotlin Multiplatform Mobile (KMM)</a> setup using Kotlin 1.8.0 and <a href="https://ktor.io/docs/getting-started-ktor-client.html">Ktor</a> 2.2.3. I have a compileSdk of 33 and minSdk of 29 for Android. I have an iOS deployment target of 15.0. I am using Ktor engines OkHttp for Android and Darwin for iOS.</p><p>Here’s an example of the shared/build.gradle.ktsfor reference</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85ced145fe92fbbdc85c3a4532c471c0/href">https://medium.com/media/85ced145fe92fbbdc85c3a4532c471c0/href</a></iframe><h3>Client Configuration</h3><p>First, we need to configure our HttpClient. We need to enable some common configuration and then platform specific too. Here is an approach you can take to achieve that:</p><p><em>commonMain/kotlin/com/example/client/HttpClient.kt`</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/106a4a4c8e726c57a96eab478aa7daf7/href">https://medium.com/media/106a4a4c8e726c57a96eab478aa7daf7/href</a></iframe><p><em>androidMain/kotlin/com/example/client/AndroidHttpClient.kt</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/559b4f1f8009c85a1e36c450f7446beb/href">https://medium.com/media/559b4f1f8009c85a1e36c450f7446beb/href</a></iframe><p><em>iosMain/kotlin/com/example/client/IosHttpClient.kt</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a26cfa175419f967d8599428b610200/href">https://medium.com/media/0a26cfa175419f967d8599428b610200/href</a></iframe><h3>Android Trust All</h3><p>For Android to trust all certificates we need to provide a custom implementation of an X509TrustManager. In this implementation, we will make every certificate check a no-op.</p><p><em>androidMain/kotlin/com/example/client/AllCertsTrustManager.kt</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/41d836a698f7984bad151892dd13a490/href">https://medium.com/media/41d836a698f7984bad151892dd13a490/href</a></iframe><p>Then to use this custom trust manager:</p><p><em>androidMain/kotlin/com/example/client/AndroidHttpClient.kt</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e24470f3866a5cdc14d6a2119ba814c4/href">https://medium.com/media/e24470f3866a5cdc14d6a2119ba814c4/href</a></iframe><p>You will likely want to limit this configuration to only test environments. How you might do that is out of the scope of this post. But you could consider setting different base URLs for each environment. Then you can use that to determine whether this configuration should be applied.</p><h3>iOS Trust All</h3><p>To allow us to loosen the server trust evaluation we must first set a property in our Info.plist</p><p><em>iosApp/iosApp/Info.plist</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48b65e49aab275055c7156363d92fc86/href">https://medium.com/media/48b65e49aab275055c7156363d92fc86/href</a></iframe><p>You can read more about <a href="https://developer.apple.com/documentation/bundleresources/information_property_list/nsexceptionallowsinsecurehttploads">NSExceptionAllowsInsecureHTTPLoads</a> here. Note that we must specify the domains which we wish to loosen.</p><p>Now we can write a custom implementation of a ChallengeHandler.</p><p><em>iosMain/kotlin/com/example/client/TrustAllChallengeHandler.kt</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/838c8c78f5b454e6b80e8d6dc7fa2808/href">https://medium.com/media/838c8c78f5b454e6b80e8d6dc7fa2808/href</a></iframe><p>In this ChallengeHandler we copy the server’s certificates. We then set them as anchor certificates. This means when we evaluate the trust with the server it should pass.</p><p>Then to use this custom ChallengeHandler:</p><p><em>iosMain/kotlin/com/example/client/IosHttpClient.kt</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0662cca40e8fae236ed30f8639a16d6/href">https://medium.com/media/d0662cca40e8fae236ed30f8639a16d6/href</a></iframe><p>Again, you will likely want to limit this configuration to only test environments.</p><h3>Summary</h3><p><strong>Please take caution with this approach. Don’t use this in production.</strong></p><p>We discussed why you might want to override the certificate trust evaluation. We explored implementing trust all certificate configurations with Ktor in a KMM project. We leveraged expect / actual to provide platform-specific configurations.</p><p><em>A previous post</em></p><p><a href="https://levelup.gitconnected.com/kotlin-multiplatform-ios-certificate-pinning-fd1abba5ca8f">Kotlin Multiplatform iOS: Certificate Pinning</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p5bxSbME-4WNItmFq9gRzQ.png" /><figcaption><em>Originally published at </em><a href="https://www.brightec.co.uk/blog/how-to-trust-all-ssl-certificates-with-kmm-and-ktor"><em>brightec.co.uk</em></a><em>. For more content check out the </em><a href="https://www.brightec.co.uk/blog"><em>brightec blog</em></a><em>.</em></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f686aec0d09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How has ‘Tap to Focus’ evolved over the years on Android?]]></title>
            <link>https://alistairsykes.medium.com/how-has-tap-to-focus-evolved-over-the-years-on-android-91dc665feb18?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/91dc665feb18</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[camerax]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[androiddev]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Tue, 29 Jun 2021 07:56:56 GMT</pubDate>
            <atom:updated>2021-06-29T07:56:56.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZM6Posb0VUpLZUbedmX6Uw.jpeg" /></figure><h4><em>The state of Android Camera: Tap to Focus</em></h4><h3>Tap to Focus</h3><p>There’s no denying how satisfying it is when your camera magically knows what you’re pointing it at. But often it’s not quite right. So, we need the ability to focus the camera ourselves.</p><p>On Android, this is conventionally done using a tap. The user taps anywhere on the screen and the camera adjusts the lens to match.</p><p>Although the concept is simple, implementing this in your apps is rather tricky.</p><h3>Camera1</h3><p>When Android launched we had a relatively simple set of APIs. Implementing Tap to Focus went something like this.</p><p>Firstly, we have to add an onTouchListener. We listen for down events and get the coordinates of the touch.</p><pre>surfaceView.setOnTouchListener { _, motionEvent -&gt; <br>    val actionMasked = motionEvent.actionMasked <br>    // Or just action <br>    if (actionMasked != MotionEvent.ACTION_DOWN) {<br>        return@setOnTouchListener false<br>    } <br>    val x = motionEvent.x<br>    val y = motionEvent.y</pre><pre>    // More code shown below <br>}</pre><p>Then we need to convert those coordinates into a Rect that the camera will understand.</p><pre>val touchRect = Rect(<br>    (x - 100).toInt(),<br>    (y - 100).toInt(),<br>    (x + 100).toInt(),<br>    (y + 100).toInt()<br>)<br>val targetFocusRect = Rect(<br>    touchRect.left * 2000/surfaceView.width - 1000,<br>    touchRect.top * 2000/surfaceView.height - 1000,<br>    touchRect.right * 2000/surfaceView.width - 1000,<br>    touchRect.bottom * 2000/surfaceView.height - 1000<br>)</pre><p>Here we are taking the touch point and creating a rectangle around it. Then we map that rectangle into the camera’s coordinate space. See Android Docs for details.</p><p>Next, we cancel any previous focus requests.</p><pre>// Cancel any previous requests<br>camera.cancelAutoFocus()</pre><p>Then we make a focus request on the camera.</p><pre>// Set the camera parameters<br>val focusList = listOf(<br>    Camera.Area(targetFocusRect, 1000)<br>)<br>val parameters = camera.getParameters()<br>parameters.setFocusAreas(focusList)<br>parameters.setMeteringAreas(focusList)<br>camera.setParameters(parameters)</pre><pre>// Request focus<br>camera.autoFocus { success, camera -&gt;<br>    // May want to schedule an cancelAutoFocus with some delay<br>    // perform any other actions as required<br>}</pre><p>Although there’s a good few lines of code, this implementation was fairly straightforward.</p><h3>Camera2</h3><p>Over the years, Android users have demanded better cameras, with more advanced features. To support this growth, a new set of APIs was needed. Android added the Camera2 APIs in Android 5 to deprecate the previous set. They expanded the range of supported features. Offering lots of flexibility to device makers.</p><p>Like Camera1, we start with an onTouchListener.</p><pre>surfaceView.setOnTouchListener { _, motionEvent -&gt;<br>    val actionMasked = motionEvent.actionMasked // Or action<br>    if (actionMasked != MotionEvent.ACTION_DOWN) {<br>        return@setOnTouchListener false<br>    }<br>    val x = motionEvent.x<br>    val y = motionEvent.y</pre><pre>    // More code shown below<br>}</pre><p>And again we need to convert that touch point into something the camera can understand. Namely, focus regions. With Camera2, this is a lot more complex.</p><pre>// Get characteristics<br>val characteristics = cameraManager.getCameraCharacteristics(cameraDevice.id)<br>val activeArraySize = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE)<br>val cameraFacing = characteristics.get(CameraCharacteristics.LENS_FACING)<br>val sensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION)</pre><pre>// Calculate rotationCompensation<br>val deviceRotation = windowManager.defaultDisplay.rotation<br>val rotationCompensation = ORIENTATIONS[deviceRotation]<br>val isFrontFacing = cameraFacing == CameraCharacteristics.LENS_FACING_FRONT<br>val rotationCompensation = if (isFrontFacing) {<br>    (sensorOrientation + rotationCompensation) % 360<br>} else { // back-facing<br>    (sensorOrientation - rotationCompensation + 360) % 360<br>}</pre><pre>// Define outputs<br>var outputX: Float<br>var outputY: Float<br>val outputWidth: Float<br>val outputHeight: Float</pre><pre>// Set initial outputs<br>if (rotationCompensation == 90 || rotationCompensation == 270) {<br>    // We&#39;re horizontal. Swap width/height. Swap x/y.<br>    outputX = y<br>    outputY = x<br>    outputWidth = surfaceView.width.toFloat()<br>    outputHeight = surfaceView.height.toFloat()<br>} else {<br>    outputX = x<br>    outputY = y<br>    outputWidth = surfaceView.width.toFloat()<br>    outputHeight = surfaceView.height.toFloat()<br>}</pre><pre>// Map to correct coordinates according to relativeCameraOrientation when (rotationCompensation) {<br>    90 -&gt;<br>        outputY = outputHeight - outputY<br>    180 -&gt; {<br>        outputX = outputWidth - outputX<br>        outputY = outputHeight - outputY<br>    }<br>    270 -&gt;<br>        outputX = outputWidth - outputX<br>}</pre><pre>// Swap x if it&#39;s a mirrored preview<br>if (isFrontFacing) {<br>    outputX = outputWidth - outputX<br>}</pre><pre>// Normalized it to [0, 1]<br>outputX /= outputWidth<br>outputY /= outputHeight</pre><pre>// Create MeteringRectangle<br>val focusAreaTouch = MeteringRectangle(<br>    (outputX * activeArraySize.width()).toInt(),<br>    (outputY * activeArraySize.height()).toInt(),<br>    (activeArraySize.width() * TOUCH_AREA_MULTIPLIER).toInt(),<br>    (activeArraySize.height() * TOUCH_AREA_MULTIPLIER).toInt(),<br>    MeteringRectangle.METERING_WEIGHT_MAX<br>)</pre><pre>val focusRegions = arrayOf(focusAreaTouch)</pre><p>There’s a lot of code here, but in essence, we are mapping our touch point into Camera2’s coordinate space. But Camera2’s coordinate space is not as static, so we need to consider:</p><ul><li>device rotation,</li><li>camera sensor rotation,</li><li>camera facing, and;</li><li>cameras sensor array size.</li></ul><p>Next, we need to check that focusing is supported by the camera.</p><pre>// Check AF supported<br>if (getCameraAvailableAfModes()?.contains(CameraMetadata.CONTROL_AF_MODE_AUTO) != true) {<br>    return<br>}<br>val maxRegionsAf = characteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AF)<br>if (maxRegionsAf == null || maxRegionsAf &lt; 1) return</pre><p>Next, cancel any previous focus requests and any ongoing repeating requests. We do this with the stopRepeating API and by making a capture request.</p><pre>// Stop repeating preview and cancel any existing focus requests<br>session.stopRepeating()<br>val cancelBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW)<br>for (surface in surfaces) {<br>    cancelBuilder.addTarget(surface)<br>}<br>cancelBuilder.set( CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL )<br>session.capture(cancelBuilder.build(), null, null)</pre><p>Now we can make the focus capture request on the camera, using the focusRegions. We create our request builder setting the various focus and region settings.</p><pre>// Create new focus request<br>val focusBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW)<br>for (surface in surfaces) {<br>    focusBuilder.addTarget(surface)<br>}<br>focusBuilder.set(CaptureRequest.CONTROL_AF_REGIONS, focusRegions)<br>val maxRegionsAe = characteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AE)<br>if (maxRegionsAe != null &amp;&amp; maxRegionsAe &gt; 0) {<br>    focusBuilder.set(CaptureRequest.CONTROL_AE_REGIONS, focusRegions)<br>}<br>val maxRegionsAwb = characteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AWB)<br>if (maxRegionsAwb != null &amp;&amp; maxRegionsAwb &gt; 0) {<br>    focusBuilder.set(CaptureRequest.CONTROL_AWB_REGIONS, focusRegions)<br>}<br>focusBuilder.set(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_AUTO)<br>focusBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_START)</pre><p>Then make the capture request.</p><pre>// Make focus request<br>val callback = object : CameraCaptureSession.CaptureCallback() {<br>    override fun onCaptureCompleted( session: CameraCaptureSession, request: CaptureRequest, result: TotalCaptureResult ) {<br>        // TODO Restart your repeating request using the same focusRegions<br>    }</pre><pre>    override fun onCaptureFailed( session: CameraCaptureSession, request: CaptureRequest, failure: CaptureFailure ) {<br>        // TODO Restart your default repeating request<br>    }<br>}<br>session.capture(focusBuilder.build(), callback, null)<br>// May want to schedule a cancel focus requests with some delay</pre><p>For this request, we add a callback. We need to restart our repeating request after the focus completes.</p><p>As you can see, the Camera2 APIs are more complex. They need more code and more in-depth knowledge of the camera system. And I haven’t even included the various try-catch scenarios in the code above.</p><h3>CameraX</h3><p>Camera2 APIs serve the purpose of providing flexible and expandable camera support. But they are difficult to work with. Requiring lots of code for simple use cases.</p><p>To combat this issue, Android introduced an unbundled library called <a href="https://medium.com/android-news/camerax-an-introduction-b3d76c3820e6">CameraX</a>. CameraX is a set of APIs that internally call the Camera2 APIs. It aims to make common use cases simple to build. Whilst it still allows more complex interaction with Camera2.</p><p>As expected, we start with an onTouchListener.</p><pre>surfaceView.setOnTouchListener { _, motionEvent -&gt;<br>    val actionMasked = motionEvent.actionMasked // Or action<br>    if (actionMasked != MotionEvent.ACTION_DOWN) {<br>       return@setOnTouchListener false<br>    }<br>    val x = motionEvent.x<br>    val y = motionEvent.y</pre><pre>    // More code shown below<br>}</pre><p>And again we need to convert that touch point into something the camera can understand. This time though, CameraX is going to do this for us.</p><pre>val factory = binding.preview.meteringPointFactory<br>val point = factory.createPoint(x, y)<br>val action = FocusMeteringAction.Builder(point, FocusMeteringAction.FLAG_AF)<br>    .addPoint(point, FocusMeteringAction.FLAG_AE)<br>    .addPoint(point, FocusMeteringAction.FLAG_AWB)<br>    .build()</pre><p>Now we make the request.</p><pre>val future = camera.cameraControl.startFocusAndMetering(action)<br>future.addListener(<br>    {<br>        try {<br>            val result = future.get()<br>            Log.d(tag, &quot;Focus Success: ${result.isFocusSuccessful}&quot;)<br>        } catch (e: ExecutionException) {<br>            Log.e(tag, &quot;Focus failed&quot;, e)<br>        } catch (e: InterruptedException) {<br>            Log.e(tag, &quot;Focus interrupted&quot;, e)<br>        }<br>    },<br>    cameraExecutor<br>)</pre><p>We don’t need to cancel the focus after some delay because CameraX also takes care of that.</p><p>CameraX simplifies the implementation for the developer. Making it easy to do the right thing.</p><h3>Summary</h3><p>With CameraX reaching stable, implementing your own camera functionality is finally becoming simpler. They have recognised the camera APIs difficult past and brought out a great suite of tools. I recommend giving CameraX a try with Google’s code lab.</p><p>Resources</p><ul><li><a href="https://github.com/brightec/KBarcode">github.com/brightec/KBarcode</a></li><li><a href="https://www.brightec.co.uk/blog/camerax-introduction">www.brightec.co.uk/blog/camerax-introduction</a></li><li><a href="https://medium.com/android-news/camerax-an-introduction-b3d76c3820e6">medium.com/android-news/camerax-an-introduction-b3d76c3820e6</a></li><li><a href="https://source.android.com/devices/camera/versioning">source.android.com/devices/camera/versioning</a></li><li><a href="https://developer.android.com/reference/android/hardware/Camera">developer.android.com/reference/android/hardware/Camera</a></li><li><a href="https://jayrambhia.com/blog/android-touchfocus">jayrambhia.com/blog/android-touchfocus</a></li><li><a href="https://stackoverflow.com/questions/17993751/whats-the-correct-way-to-implement-tap-to-focus-for-camera">stackoverflow.com/questions/17993751/whats-the-correct-way-to-implement-tap-to-focus-for-camera</a></li><li><a href="https://gist.github.com/royshil/8c760c2485257c85a11cafd958548482">gist.github.com/royshil/8c760c2485257c85a11cafd958548482</a></li><li><a href="https://medium.com/androiddevelopers/whats-new-in-camerax-fb8568d6ddc">medium.com/androiddevelopers/whats-new-in-camerax-fb8568d6ddc</a></li><li><a href="https://07687375219170485808.googlegroups.com/attach/b86ef247362e5/Touch-to-focus%20API%20Draft.pdf">07687375219170485808.googlegroups.com/attach/b86ef247362e5/Touch-to-focus%20API%20Draft.pdf</a></li><li><a href="https://androidx.tech/artifacts/camera/camera-core/1.0.0-source/androidx/camera/core/DisplayOrientedMeteringPointFactory.java.html">androidx/camera/core/DisplayOrientedMeteringPointFactory.java</a></li><li><a href="https://androidx.tech/artifacts/camera/camera-core/1.0.0-source/androidx/camera/core/MeteringPointFactory.java.html">androidx/camera/core/MeteringPointFactory.java</a></li><li><a href="https://medium.com/androiddevelopers/whats-new-in-camerax-fb8568d6ddc">medium.com/androiddevelopers/whats-new-in-camerax-fb8568d6ddc</a></li><li><a href="https://developer.android.com/training/camerax">developer.android.com/training/camerax</a></li><li><a href="https://developer.android.com/training/camerax/configuration#control-focus">developer.android.com/training/camerax/configuration#control-focus</a></li></ul><p><em>Previous Post</em></p><p><a href="https://alistairsykes.medium.com/multi-schema-wsdl-and-separate-packages-41c829a23b05">Multi Schema WSDL and separate packages</a></p><p><em>Originally published at </em><a href="https://www.brightec.co.uk/blog/how-has-tap-to-focus-evolved-over-the-years-on-android"><em>https://www.brightec.co.uk</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91dc665feb18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multi Schema WSDL and separate packages]]></title>
            <link>https://medium.com/swlh/multi-schema-wsdl-and-separate-packages-41c829a23b05?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/41c829a23b05</guid>
            <category><![CDATA[jax-ws]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[wsdl]]></category>
            <category><![CDATA[soap]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Fri, 18 Jun 2021 15:10:07 GMT</pubDate>
            <atom:updated>2021-06-18T15:10:07.323Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vjm_Cp2L-C_7hv2HaSe3aQ.jpeg" /></figure><h4><em>How to use JAXB bindings with WSDL to separate schemas into different packages.</em></h4><h3>WSDL</h3><p>As discussed in my <a href="https://medium.com/swlh/wsdl-client-generation-with-kotlin-and-gradle-398483e32191">previous blog</a>, WSDL is an XML format that describes network services. It defines endpoints and their request and response formats.</p><p>WSDL files contain schemas to describe those request and response objects. A single WSDL file could contain multiple schemas. This is commonly used to share some objects between different network services. Such as to define some common types.</p><h3>Example</h3><p>You may have two WSDL files.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe07628dcebbba04bed2a3ee39fbf324/href">https://medium.com/media/fe07628dcebbba04bed2a3ee39fbf324/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23270afebfda5b45bc21cd46a76659e5/href">https://medium.com/media/23270afebfda5b45bc21cd46a76659e5/href</a></iframe><p>One describes a shopping service, and the other defines a checkout service. In the checkout service, you might buy things you shopped for. So it’s easy to see why you’d want to share some objects.</p><h3>Packages</h3><p>You can create your client library with these WSDL files as-is. But you might want to put files from the different schemas into separate packages.</p><p>To achieve this you need to use the JAXB bindings feature. For each WSDL file create a new bindings file.</p><p>For example:</p><p>- src/main/resources/META-INF/bindings-shopping.jaxb</p><p>- src/main/resources/META-INF/bindings-checkout.jaxb</p><p>Within these files, we define the base package which our Services will go into. Then we also define a package for each of the schemas.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7728b752eb2e3947d002b3a77bb3e26c/href">https://medium.com/media/7728b752eb2e3947d002b3a77bb3e26c/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3aaa61f3aa88e34f2955fde7819f1225/href">https://medium.com/media/3aaa61f3aa88e34f2955fde7819f1225/href</a></iframe><p>Now all that’s left is to tell our wsimport task about these bindings files.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/338fd6c457d8de9c8d8938f16ae1917c/href">https://medium.com/media/338fd6c457d8de9c8d8938f16ae1917c/href</a></iframe><p><strong>Now run the </strong><strong>wsimport task. It will generate a HTTP client using the separate packages you specified.</strong></p><p><em>Previous Post</em></p><p><a href="https://levelup.gitconnected.com/internationalize-your-multi-module-spring-boot-application-33dc83c36dc6">Internationalize your multi-module Spring Boot Application</a></p><p><em>Originally published at </em><a href="https://www.brightec.co.uk/blog/how-to-use-jaxb-bindings-with-wsdl-to-separate-schemas-into-different-packages"><em>https://www.brightec.co.uk</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41c829a23b05" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/multi-schema-wsdl-and-separate-packages-41c829a23b05">Multi Schema WSDL and separate packages</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Internationalize your multi-module Spring Boot Application]]></title>
            <link>https://levelup.gitconnected.com/internationalize-your-multi-module-spring-boot-application-33dc83c36dc6?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/33dc83c36dc6</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[internationalization]]></category>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[modularization]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Thu, 03 Sep 2020 11:08:40 GMT</pubDate>
            <atom:updated>2020-09-04T18:18:20.294Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXHHzNCKFXIPFaAHrv-Xdw.jpeg" /></figure><h4><em>How and where to define your user-facing strings.</em></h4><h3>Messages.properties</h3><p>You’ve probably already read about the messages.properties file. It allows you to define any strings you wish to present to an end-user.</p><p>messages.properties:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/844ab09fe6915dd5b70d06b53e7beffc/href">https://medium.com/media/844ab09fe6915dd5b70d06b53e7beffc/href</a></iframe><p>To retrieve one of these strings in code you first need to get a MessageSource. This is provided via <a href="https://www.baeldung.com/spring-dependency-injection">spring dependency injection</a>.</p><p>Constructor injection:</p><pre>@Service // Or some other `Component` annotation<br>class SomeService( private val messageSource: MessageSource )</pre><p>Property injection:</p><pre>@Autowired private lateinit var messageSource: MessageSource</pre><p>Then you can call getMessage:</p><pre>messageSource.getMessage(&quot;title.example&quot;, null, LocaleContextHolder.getLocale())</pre><p>args can be provided for string replacement. For example:</p><pre>messageSource.getMessage(&quot;message.hello&quot;, arrayOf(&quot;Joe Bloggs&quot;), LocaleContextHolder.getLocale())</pre><h3>Internationalization</h3><p>Notice above, we pass LocaleContextHolder.getLocale() as a Locale to the getMessage call. This tells the MessageSource which language to provide.</p><p>LocaleContextHolder provides the current Locale that spring is aware of. This is a powerful mechanism. We don’t need to add any custom code to our RestController’s or otherwise to determine Locale. Callers can set the locale as a request header and spring will make that available.</p><p>To provide other language strings we add a new messages file, messages_fr.properties:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/122dd408c29caf6f1ecf9098fdb87b9b/href">https://medium.com/media/122dd408c29caf6f1ecf9098fdb87b9b/href</a></iframe><p>To learn more, check out this <a href="https://www.baeldung.com/spring-boot-internationalization">guide</a>.</p><h3>Modularization</h3><p>When modularizing your application you may run into trouble. By default the messages.properties files from each module will conflict with each other. Only one set of messages will be available.</p><p>To avoid this, all your messages files need to have different names. A good convention to follow is to use your module name. For example: messages-application.properties, messages-application_fr.properties, messages-library.properties, messages-library_fr.properties.</p><p>Now we need to expose these to the MessageSource. By default, only files named message.properties will be found.</p><p>In your application.properties file add:</p><pre>spring.messages.basename=messages-application,messages-library</pre><p>Notice we do not include the language extension or the file extension here.</p><p><strong>That’s it. You can now provide strings in each of your different modules.</strong></p><p><em>Originally published at </em><a href="https://www.brightec.co.uk/blog/internationalize-your-multi-module-spring-boot-application"><em>https://www.brightec.co.uk</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33dc83c36dc6" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/internationalize-your-multi-module-spring-boot-application-33dc83c36dc6">Internationalize your multi-module Spring Boot Application</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WSDL Client Generation With Kotlin and Gradle]]></title>
            <link>https://medium.com/swlh/wsdl-client-generation-with-kotlin-and-gradle-398483e32191?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/398483e32191</guid>
            <category><![CDATA[jax-ws]]></category>
            <category><![CDATA[soap]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[wsdl]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Thu, 13 Aug 2020 13:16:24 GMT</pubDate>
            <atom:updated>2021-06-14T08:53:18.442Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PrXb17ewu8CGH9SLK7Z5gg.jpeg" /></figure><h4><em>How to use JAXWS to generate HTTP client code using the Gradle Kotlin DSL.</em></h4><h3>WSDL</h3><p>WSDL (Web Services Description Language) is an XML format. It describes network services, their endpoints and the corresponding request and response formats.</p><p>WSDL is commonly used in conjunction with a SOAP (Simple Object Access Protocol) API. Soap can be thought of as a way of structuring your API. Similar to what REST (REpresentational State Transfer) is.</p><h3>WSDL File</h3><p>Typically, the result of using WSDL is a .wsdl file. You may have multiple files, one for each service, and these can come in handy when trying to consume an API.</p><p>Since a .wsdl file describes exactly what the API looks like, you can use it to generate HTTP client code. This means less code you have to write yourself. It also means reduced maintenance costs when an API gets updated.</p><h3>Gradle Kotlin DSL</h3><p>So how do you generate the HTTP client code? The first step is to create a configuration:</p><pre>val jaxws by configurations.creating</pre><p>Then we add a dependency to that configuration:</p><pre>jaxws(&quot;com.sun.xml.ws:jaxws-tools:2.1.4&quot;)</pre><p><a href="https://javaee.github.io/metro-jax-ws/">JAXWS</a> is a library which provides tooling, including the ability to read a .wsdl file.</p><p>Next we need to create a task to import our .wsdl file and produce our HTTP client code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/96a13c09eec68ca63ebbf8dbc3c817c1/href">https://medium.com/media/96a13c09eec68ca63ebbf8dbc3c817c1/href</a></iframe><p>There are a few things to take note of here. We are using <a href="https://docs.gradle.org/current/userguide/ant.html">Ant</a> to help create our task. The resulting task (named wsimport-myservice) will look for the file src/main/resources/META-INF/wsdl/SomeService.wsdl and generate HTTP client code. That code will live in src/main/java with a package of com.example.myproject.</p><p>The location of the .wsdl file is important. It needs to be compiled into your output, i.e. jar file. It needs to be accessed at runtime. Once you deploy your application it is common for hardcoded paths not to work correctly. To solve this we use the <a href="https://svn.ssec.wisc.edu/repos/APSPS/trunk/SPS/LIB/jaxws_2_1_7/jaxws-ri/docs/catalog-support.html">JAXWS catalog</a> feature.</p><p>src/main/resources/META-INF/jax-ws-catalog.xml</p><pre>&lt;catalog xmlns=&quot;urn:oasis:names:tc:entity:xmlns:xml:catalog&quot; prefer=&quot;system&quot;&gt;<br>    &lt;system systemId=&quot;http://localhost/wsdl/SomeService.wsdl&quot;<br>        uri=&quot;wsdl/SomeService.wsdl&quot;/&gt;<br>&lt;/catalog&gt;</pre><p>Here we are telling JAXWS that it should map a wsdlLocation (defined in the gradle task) of http://localhost/wsdl/SomeService.wsdl to a URI of wsdl/SomeService.wsdl. Don’t worry, your .wsdl file doesn’t need to be available at http://localhost/wsdl/SomeService.wsdl. The catalog will always map this to the provided URI.</p><p>Thus, at runtime, the HTTP client code will know where to access the .wsdl file correctly.</p><h3>HTTP Client</h3><p>So after running the gradle task wsimport-myservice we now have our HTTP client code, what next? To call a method against the API you need to get hold of a service. The name of this is defined in the .wsdl file. It should be listed within a wsdl:service tag. It will be something like SomeServiceEndpointImplService. This class will extend from javax.xml.ws.Service.</p><p>Autocomplete within an IDE can be very helpful at this stage.</p><pre>val service = SomeServiceEndpointImplService()</pre><p>Now you need to get the port. Under the same wsdl:service tag you will find a wsdl:port tag. Here you will find the name of your port.</p><pre>val port = service.somePort</pre><p>On the port, you will find a function corresponding to each of the functions on the API. It will detail what objects need to be passed in and what the return will be. Since these functions are API calls they can throw exceptions, so you should bear this in mind.</p><h3>Kotlin Java Interop</h3><p>JAXWS imports the .wsdl file into Java HTTP client code. This means that you will be calling Java from your Kotlin code.</p><p>Calling the API functions will feel a little strange, to begin with, if you’re not used to Java interop. But it does become familiar over time.</p><p>Here is an example:</p><pre>val service = SomeServicesEndpointImplService()<br>val port = service.somePort<br>val request = SomeRequestType().apply {<br>    someParam = SomeOtherModel().apply {<br>        thing = &quot;thing&quot;<br>    }<br>    someOtherParam = &quot;Something&quot;<br>}<br>val response = port.someFunction(request)</pre><p>Check out the <a href="https://kotlinlang.org/docs/reference/java-interop.html">Kotlin interop guide</a> for more details on this.</p><p><em>Previous Post</em></p><p><a href="https://android.jlelse.eu/introducing-vectordrawable-seekable-b96ef57ffe36">Introducing Vectordrawable-Seekable</a></p><p><em>Originally published at </em><a href="https://www.brightec.co.uk/blog/wsdl-client-generation-with-kotlin-and-gradle"><em>https://www.brightec.co.uk</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=398483e32191" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/wsdl-client-generation-with-kotlin-and-gradle-398483e32191">WSDL Client Generation With Kotlin and Gradle</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Vectordrawable-Seekable]]></title>
            <link>https://medium.com/android-news/introducing-vectordrawable-seekable-b96ef57ffe36?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/b96ef57ffe36</guid>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[animation]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Mon, 11 May 2020 10:32:54 GMT</pubDate>
            <atom:updated>2020-05-11T13:35:28.363Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Febnyxzk7cXlTWgRoYpUYQ.jpeg" /></figure><h4><em>Using the new and improved AnimatedVectorDrawable to pause and seek your animations.</em></h4><h3>AnimatedVectorDrawable</h3><p>Android SDK 21 introduced both the VectorDrawable and the AnimatedVectorDrawable. This allowed you to use vector assets within your app, and even animate them.</p><p>They’ve iterated on these since then, but AnimatedVectorDrawable was still missing something. You couldn’t manipulate and control the animation. There was no pause or seek functionality.</p><h3>Core-Animation</h3><p>The Android team has been hard at work backporting the framework Animator APIs. They have created a separate unbundled AndroidX library called Core-Animation.</p><p>The Animator APIs have been around for some time. But they didn’t provide the capabilities needed for this pause and seek functionality. So they needed to be unbundled and then iterated on.</p><h3>Vectordrawable-Seekable</h3><p>Once Core-Animation was available the Android team could create the Vectordrawable-Seekable library. This library revolves around the class SeekableAnimatedVectorDrawable.</p><p>Under the hood, this class uses the AnimatorSet and subsequently Animator from Core-Animation. These provide the pause and seek functionality.</p><h3>How to</h3><h4>Create the vector</h4><p>Firstly, you need a vector asset of the image you wish to animate. This works best if it is simple and optimised.</p><p>See these resources for information on optimising assets:</p><p>- <a href="https://www.brightec.co.uk/blog/creating-vector-drawables-android">https://www.brightec.co.uk/blog/creating-vector-drawables-android</a></p><p>- <a href="https://arturdryomov.dev/posts/optimizing-android-vector-images/">https://arturdryomov.dev/posts/optimizing-android-vector-images/</a></p><p>For this example I am going to use an Android:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1f49ee65961374471c7019479d595cf/href">https://medium.com/media/c1f49ee65961374471c7019479d595cf/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/0*So5ZkO11SRkrkvWH.png" /></figure><p>This XML file should be placed in your res/drawable directory.</p><p>Notice the group names, as these allow us to reference each part of the image later. Notice also the pivot points defined. These define the pivot around which rotation would happen.</p><h4>Create the animation</h4><p>To define the animation itself you can create another XML file. This defines an ObjectAnimator.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51350379510a257647e0a635938370a3/href">https://medium.com/media/51350379510a257647e0a635938370a3/href</a></iframe><p>This file goes into your res/anim directory.</p><p>You can see from the attributes that this is a rotation animation. It will repeat infinitely by going forward and then reversing and going backwards. It will rotate from 180° to 220° over 600 milliseconds each repeat.</p><h4>Create AnimatedVectorDrawable</h4><p>We can combine these two into an animated-vector. This can again be defined within an XML file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0fb6305ca150a51e7ed1901cdcceff5e/href">https://medium.com/media/0fb6305ca150a51e7ed1901cdcceff5e/href</a></iframe><p>This XML file should be placed in your res/drawable directory.</p><p>This file connects the image and animation. The drawable is defined near the top. The animation rotation is targeting the arm-left.</p><h4>Using AnimatedVectorDrawable</h4><p>You can now use this animated-vector to display your animation on the screen.</p><p>Either set it on your ImageView via:</p><pre>app:srcCompat=&quot;@drawable/img_android_animated&quot;</pre><p>Or you can define it programmatically:</p><pre>val drawable = AnimatedVectorDrawableCompat.create(<br>    this, R.drawable.img_android_animated<br>)<br>imageView.setImageDrawable(drawable)<br>drawable.start()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rum8AFs1qaNsEC-O.gif" /></figure><h4>Converting to SeekableAnimatedVectorDrawable</h4><p>Instead of creating an AnimatedVectorDrawable from your XML, create a SeekableAnimatedVectorDrawable:</p><pre>val drawable = SeekableAnimatedVectorDrawable.create(<br>    this, R.drawable.img_android_animated<br>)<br>imageView.setImageDrawable(drawable)<br>drawable.start()</pre><p>Now you have access to pause seek functionality.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F415890449%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F415890449&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F889531205_960.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="970" height="2048" frameborder="0" scrolling="no"><a href="https://medium.com/media/ccaec0591db3af0e80def8e14b37e5fe/href">https://medium.com/media/ccaec0591db3af0e80def8e14b37e5fe/href</a></iframe><p><strong>Play/Pause</strong></p><pre>drawable.pause()<br>drawable.play()</pre><p><strong>Duration</strong></p><pre>drawable.totalDuration</pre><p>Note for infinite animations this will return -1.</p><p><strong>Current Time</strong></p><pre>drawable.currentPlayTime</pre><p>This can be both gotten and set. If you set this value, the animation will be set to that time and continued if it was already running.</p><h3>Conclusion</h3><p>These new API’s provide some interesting functionality. It unlocks some very cool and delighting animations.</p><p>Both Core-Animation and Vectordrawable-Seekable are in alpha at the time of writing. It is worth noting that Core-Animation is mostly a backport of the existing framework API’s. So arguably it should be more stable than a usual alpha release.</p><p><a href="https://developer.android.com/jetpack/androidx/releases/vectordrawable">https://developer.android.com/jetpack/androidx/releases/vectordrawable</a> <a href="https://developer.android.com/jetpack/androidx/releases/core">https://developer.android.com/jetpack/androidx/releases/core</a></p><p>Now you can pause and seek to your heart’s content.</p><p><em>Previous Post</em></p><p><a href="https://android.jlelse.eu/education-through-motion-b500a77a3b5">Education through motion</a></p><p><em>Originally published at </em><a href="https://www.brightec.co.uk/blog/introducing-vectordrawable-seekable"><em>https://www.brightec.co.uk</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b96ef57ffe36" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/introducing-vectordrawable-seekable-b96ef57ffe36">Introducing Vectordrawable-Seekable</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Education through motion]]></title>
            <link>https://medium.com/android-news/education-through-motion-b500a77a3b5?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/b500a77a3b5</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Thu, 09 Apr 2020 14:07:52 GMT</pubDate>
            <atom:updated>2020-04-09T14:46:24.349Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QZCFzVhUO4jzcgJr19XwDA.jpeg" /></figure><h4><em>Educating Android users can be subtle by using motion</em></h4><h3>Material Design</h3><p>The material design system will be familiar to most, as one of the most widely used design systems. It’s a visual language that represents good design principles whilst allowing expressive branding.</p><p>Foundationally, it is based on the physics of the world. This makes it natural and familiar to users. It models the way objects move and how they interact with each other.</p><h3>Motion</h3><p>Motion can celebrate the completion of a task, delight the user, or help to drive the user through a flow. The way objects move and interact can bring a touch of class and express your brand.</p><p>You can also use motion to help teach the user how to interact with an element. Often subtle bounces, shakes, and elevations can improve user experience and understanding.</p><h3>Animations</h3><p>On Android, animation API’s have been re-written and changed over time. Currently, there are two main ways. The Animation API’s are the older API’s, but they allow you to use the anim resource files. The Animator API’s are the newer API’s which typically are a little easier to work with. Animator’s change the properties of an object/view. Whilst Animation’s only change the visual representation of them.</p><h3>Examples</h3><p>I have created some examples which give a flavour of what is achievable using motion on Android. There are many ways of creating the same animations, so I have tried to showcase a variety. Hopefully, these examples will inspire you to experiment with motion in your apps.</p><h4>Clickable</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JoOMmrUqzeFop0bg.gif" /></figure><p>Some elements may not appear clickable to some users. For example the items within a list. Although changing the static visual may help, using motion can be more powerful.</p><p>Lists commonly will utilize a RecyclerView with an accompanying adapter. If a list item is clickable, you may want to set a background of selectableItemBackground. This provides a ripple effect upon user click, giving visual confirmation of a click.</p><p>You can also trigger this effect manually, thus giving a visual clue to the user.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc9fa1075ae2775284954e34f72fc2ff/href">https://medium.com/media/dc9fa1075ae2775284954e34f72fc2ff/href</a></iframe><p>Firstly, I ensure that the background is a RippleDrawable as a safety measure.</p><p>Then I post a runnable on the animation queue of the itemView. I delay it to ensure it’s after the screen has loaded and so visible to the user.</p><p>Then I set the hotspot. This is the epicenter of the ripple effect. For the goal of educating a user, this should be in a natural place where the user would interact with the element.</p><p>Then to trigger the ripple I set the state of the drawable to pressed and enabled.</p><p>To clean up after the effect has finished, we set the state back to an empty array.</p><h4>Swipe up to unlock</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F405796815%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F405796815&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F876086450_640.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="720" height="1280" frameborder="0" scrolling="no"><a href="https://medium.com/media/5540c3bab9b000119a8b44768f105fd4/href">https://medium.com/media/5540c3bab9b000119a8b44768f105fd4/href</a></iframe><p>This motion might be familiar to you. With this bouncing motion, Android is trying to show the user that you can swipe up to unlock the screen.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6bb4f0c2ca2ad9b1d5377e6f5150825f/href">https://medium.com/media/6bb4f0c2ca2ad9b1d5377e6f5150825f/href</a></iframe><p>I define two ObjectAnimator’s. One for the motion upwards and one for downwards. I create an AnimatorSet to control their behaviour together.</p><p>The key to this motion is the Interpolator’s. The upwards motion has a linear speed. The downwards motion uses the BounceInterpolator. This simulates the dropping of an object and it bouncing on the ground.</p><h4>Shake</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n7c0zP-_HX9dN4Xt.gif" /></figure><p>A shaking motion can help draw the immediate attention of the user. You can use it to inform the user of an error or that a button needs to be urgently clicked.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd32c9fbc0f5a7f3c085290fcb288cbe/href">https://medium.com/media/cd32c9fbc0f5a7f3c085290fcb288cbe/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36028812e156efb7d8410d9e0cb49df8/href">https://medium.com/media/36028812e156efb7d8410d9e0cb49df8/href</a></iframe><p>I create an anim resource that represents the shake. I start this anim by calling startAnimation() on the TextView.</p><p>Then I fade the TextView to an alpha of 0, after a short delay, to hide the error.</p><h3>Summary</h3><p>Experiment with simple motion. It can have a huge impact on the usability of your app. It can delight users and give a sense of polish and quality.</p><h3>Sources</h3><ul><li><a href="https://material.io/design/introduction/">https://material.io/design/introduction/</a></li><li><a href="https://material.io/design/motion/understanding-motion.html">https://material.io/design/motion/understanding-motion.html</a></li></ul><p><em>Previous Post</em></p><p><a href="https://levelup.gitconnected.com/kotlin-multiplatform-ios-certificate-pinning-fd1abba5ca8f">Kotlin Multiplatform iOS: Certificate Pinning</a></p><p><em>Originally published at </em><a href="https://www.brightec.co.uk/blog/education-through-motion"><em>https://www.brightec.co.uk</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b500a77a3b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/education-through-motion-b500a77a3b5">Education through motion</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin Multiplatform iOS: Certificate Pinning]]></title>
            <link>https://levelup.gitconnected.com/kotlin-multiplatform-ios-certificate-pinning-fd1abba5ca8f?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd1abba5ca8f</guid>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[ktor]]></category>
            <category><![CDATA[kotlin-multiplatform]]></category>
            <category><![CDATA[certificate-pinning]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Wed, 04 Mar 2020 15:03:26 GMT</pubDate>
            <atom:updated>2020-03-23T14:38:08.320Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PrXb17ewu8CGH9SLK7Z5gg.jpeg" /></figure><h4>How to implement certificate pinning in Kotlin Multiplatform using Ktor</h4><h3>Certificate Pinning</h3><p>Pinning certificates is a common practice when interacting with remote APIs. It is the act of constraining which certificates you trust. This helps to defend against attacks on certificate authorities. It also helps combat man-in-the-middle attacks.</p><p>There is a multitude of information available about certificate pinning. Here is some to get you started:</p><p>- <a href="https://owasp.org/www-community/controls/Certificate_and_Public_Key_Pinning">https://owasp.org/www-community/controls/Certificate_and_Public_Key_Pinning</a></p><p>- <a href="https://labs.nettitude.com/tutorials/tls-certificate-pinning-101/">https://labs.nettitude.com/tutorials/tls-certificate-pinning-101/</a></p><p>- <a href="https://docs.broadcom.com/docs/certificate-pinning-en">https://docs.broadcom.com/docs/certificate-pinning-en</a></p><h3>Kotlin Multiplatform</h3><p><a href="https://kotlinlang.org/docs/reference/multiplatform.html">Kotlin Multiplatform</a> (KMP) is a way of writing cross-platform code in <a href="https://kotlinlang.org/">Kotlin</a>. It is not about compiling all code for all platforms, and it doesn’t limit you to a subset of common APIs. KMP provides mechanisms for writing platform-specific implementations for a common API.</p><h3>Ktor</h3><p><a href="https://ktor.io/">Ktor</a> is a KMP framework for building asynchronous servers and clients. Ktor’s client libraries enable you to author multiplatform code which connects to remote APIs.</p><p>Ktor client supports JVM, Android, iOS, Javascript, macOS, Linux, and Windows.</p><p>Ktor provides engines that perform the platform-specific requests. These engines conform to a common interface. In common code, you can make HTTP requests which go through the engines.</p><p>For Android, you can use an <a href="https://square.github.io/okhttp/">OkHttp</a> engine. Built into Ktor there is an iOS engine that uses the NSURLSession classes.</p><h3>Pinning with OkHttp</h3><p>OkHttp has long supported certificate pinning against public keys. Implementation is simple, and I love their approach to this problem.</p><p><a href="https://square.github.io/okhttp/4.x/okhttp/okhttp3/-certificate-pinner/#setting-up-certificate-pinning">https://square.github.io/okhttp/4.x/okhttp/okhttp3/-certificate-pinner/#setting-up-certificate-pinning</a></p><h3>Pinning with iOS</h3><p>On iOS, this is not so simple. You have to override a function on NSURLSessionDataDelegateProtocol and configure an NSURLSession with it.</p><p><a href="https://developer.apple.com/documentation/foundation/nsurlsessiondelegate/1409308-urlsession?language=objc">https://developer.apple.com/documentation/foundation/nsurlsessiondelegate/1409308-urlsession?language=objc</a></p><p>Represented in Kotlin:</p><pre>fun invoke(<br>    session: NSURLSession,<br>    challenge: NSURLAuthenticationChallenge,<br>    completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential?) -&gt; Unit<br>)</pre><p>Within this function, you need to check various aspects of the challenge. Ultimately checking the certificate matches your expectations.</p><h3>CertificatePinner</h3><p>I set out to write this certificate pinning functionality into a succinct class for KMP. Since we need to be able to override a delegate method, we are required to use at least version 1.3.2 of Ktor.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/753aa2b4335ae3e730ff13e8ccfe684e/href">https://medium.com/media/753aa2b4335ae3e730ff13e8ccfe684e/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d625233df6fc63e547061949782ffd9e/href">https://medium.com/media/d625233df6fc63e547061949782ffd9e/href</a></iframe><p>This is the class I came up with. It is inspired by OkHttp’s CertificatePinner and matches pretty closely with their implementation.</p><h3>How to use</h3><p>To get started, configure certificate pinning with a broken configuration. Then read the expected configuration in the logs when the connection fails. Be sure to do this on a trusted network, and without man-in-the-middle tools like <a href="http://charlesproxy.com/">Charles</a> or <a href="http://fiddlertool.com/">Fiddler</a>.</p><p>For example, to pin <a href="https://publicobject.com,/">https://publicobject.com,</a> start with a broken configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc8d445486d9f079fa95e3353310e27a/href">https://medium.com/media/fc8d445486d9f079fa95e3353310e27a/href</a></iframe><p>As expected, this fails with an exception, see the logs:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67b7b2b3c5817f5e913a4cb1dd948dd9/href">https://medium.com/media/67b7b2b3c5817f5e913a4cb1dd948dd9/href</a></iframe><p>Now paste the public key hashes into the certificate pinner’s configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d96f2bb7ef72f52eb2dae5695f85770f/href">https://medium.com/media/d96f2bb7ef72f52eb2dae5695f85770f/href</a></iframe><h3>Under the hood</h3><h4>ChallengeHandler</h4><p>The first thing to note is that CertificatePinner implements ChallengeHandler. This means it implements the required delegate method. It will be called within the iOS engine.</p><p>This Builder and Pin classes enable the user to easily create a set of public keys to pin against. They also provide wildcard functionality. You can read about this in the class documentation.</p><h4>NSURLSession Delegate</h4><p>The invoke function is where the actual pinning functionality takes place.</p><p>First I retrieve the hostname from the challenge. Then I check to see if there are any pins against that host. I then check to see if the authenticationMethod is suitable for certificate pinning.</p><p>See <a href="https://developer.apple.com/documentation/foundation/nsurlauthenticationmethodservertrust?language=objc">apple documentation</a> for details.</p><p>I retrieve the serverTrust and check it’s <a href="https://developer.apple.com/documentation/security/2980705-sectrustevaluatewitherror">validity</a> (if configured to).</p><p>Now comes the point where I check the certificates public keys against the ones that are pinned. Most of the complexity here is retrieving the public key in the format I want.</p><p>Once in the correct format, we check it matches the pinned ones and return the result.</p><h3>Conclusion</h3><p>This was a challenging problem to solve. It involved using Kotlin’s C-interop features, which can be difficult to grasp.</p><p>This class is available for you to use and change as you like. Hopefully, it helps you to solve this problem too.</p><p><em>Previous Post</em></p><p><a href="https://medium.com/@alistairsykes/kotlin-multiplatform-android-ios-connecting-coding-and-culture-a2412efd7c0c">Kotlin Multiplatform Android/iOS: Connecting coding and culture</a></p><p><em>Originally published at </em><a href="https://www.brightec.co.uk/blog/kotlin-multiplatform-ios-certificate-pinning"><em>https://www.brightec.co.uk</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd1abba5ca8f" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/kotlin-multiplatform-ios-certificate-pinning-fd1abba5ca8f">Kotlin Multiplatform iOS: Certificate Pinning</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin Multiplatform Android/iOS: Connecting coding and culture]]></title>
            <link>https://medium.com/swlh/kotlin-multiplatform-android-ios-connecting-coding-and-culture-a2412efd7c0c?source=rss-814f06d30881------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2412efd7c0c</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[kotlin-multiplatform]]></category>
            <category><![CDATA[culture]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Alistair Sykes]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 08:30:31 GMT</pubDate>
            <atom:updated>2020-02-06T08:30:31.198Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vjm_Cp2L-C_7hv2HaSe3aQ.jpeg" /></figure><h4>How does Kotlin Multiplatform affect your development culture?</h4><h3>Kotlin Multiplatform</h3><p><a href="https://kotlinlang.org/docs/reference/multiplatform.html">Kotlin Multiplatform</a> (KMP) is a way of writing cross-platform code in <a href="https://kotlinlang.org/">Kotlin</a>. It is not about compiling all code for all platforms, and it doesn’t limit you to a subset of common APIs. KMP provides mechanisms for writing platform-specific implementations for a common API.</p><h3>Culture</h3><p>Culture is a big focus for many companies. We want to be in and build meaningful places to work. We want to be collaborative and make things better together.</p><p>However, we also like to feel part of a community. Often the community we choose to belong to is related to our platform of choice, or to the technology we use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OR-zre5YuuLhOIyQ.jpg" /></figure><p>Introducing a cross/multi-platform technology can challenge our existing cultures and even identity.</p><h3>Multiplatform Shift</h3><p>Shifting to a multiplatform technology means a developer now belongs to both teams. They have to support one another if the new technology is to succeed.</p><p>We must consider the needs of our colleagues first, sometimes over our own.</p><p>KMP naturally falls more within the Android camp. This is because it uses the same programming language. Often the Android developers within a team are asked to write the KMP shared code. Your Android developers need to make the first steps towards the common goals of the whole team.</p><h3>Put iOS first</h3><p>It might be difficult to stomach for some, but you need to put your iOS colleague’s needs first.</p><p>KMP is a Kotlin technology, so it will more naturally feel familiar and function better on a JVM platform. If you hit a fork, and you’ve got to choose between a better iOS or Android implementation, choose iOS. The likelihood is that the pain for Android developers will be less than the pain would be for iOS developers.</p><p>KMP has written a specific page on interoperability. Use this to help you make life easier for your iOS teammates.</p><p><a href="https://kotlinlang.org/docs/reference/native/objc_interop.html">Interop-Guide</a></p><p>Wherever possible, provide iOS (and Android) specific extension functions. Try to make integration for all platforms as intuitive as possible.</p><h3>Dependency</h3><p>Consider the new dependency you are creating upon one developer to another. Without premeditating this, you might find a tension builds between those developers.</p><p>Raise this concern early, talk about ways to ease it.</p><p>Consider how you might schedule the work. How will you communicate the changes in the latest build?</p><h3>My experience</h3><p>I have worked on two projects, which utilise KMP. We recently retrospected KMP in isolation of the projects. The reception from iOS developers far exceeded my expectations. Due, at least in part, to our consideration and iOS first approach.</p><p>We also found that it helped our developers communicate better across teams. We used KMP for writing our API integration code. We felt that because we all shared the API integration, we all shared a common language of the subject matter.</p><h3>Conclusion</h3><p>I have found that when given some consideration, using a cross/multi-platform technology can “improve” your culture. It can increase communication. It can shorten the distance between the platform camps. It can encourage a greater team vibe.</p><p><em>Previous Post</em></p><p><a href="https://levelup.gitconnected.com/kotlin-multiplatform-android-ios-testing-492a485926fc">Kotlin Multiplatform Android/iOS: Testing</a></p><p><em>Originally published at </em><a href="https://www.brightec.co.uk/ideas/kotlin-multiplatform-androidios-connecting-coding-and-culture"><em>https://www.brightec.co.uk</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2412efd7c0c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/kotlin-multiplatform-android-ios-connecting-coding-and-culture-a2412efd7c0c">Kotlin Multiplatform Android/iOS: Connecting coding and culture</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>