<?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 Ngenge Senior on Medium]]></title>
        <description><![CDATA[Stories by Ngenge Senior on Medium]]></description>
        <link>https://medium.com/@ngengesenior?source=rss-1977cc208376------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JekwUbhjb-xHG8DhG4ZLYg.jpeg</url>
            <title>Stories by Ngenge Senior on Medium</title>
            <link>https://medium.com/@ngengesenior?source=rss-1977cc208376------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 12:12:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ngengesenior/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[I am Starting to Hate LinkedIn]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://ngengesenior.medium.com/i-am-starting-to-hate-linkedin-40cbb71d515c?source=rss-1977cc208376------2"><img src="https://cdn-images-1.medium.com/max/2600/0*DHr1IKfVlDuE1Xry" width="3200"></a></p><p class="medium-feed-snippet">Lately, every time I open LinkedIn, I find myself wondering if this is the same platform I knew years ago. When people used to talk about&#x2026;</p><p class="medium-feed-link"><a href="https://ngengesenior.medium.com/i-am-starting-to-hate-linkedin-40cbb71d515c?source=rss-1977cc208376------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://ngengesenior.medium.com/i-am-starting-to-hate-linkedin-40cbb71d515c?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/40cbb71d515c</guid>
            <category><![CDATA[instagram]]></category>
            <category><![CDATA[linkedin]]></category>
            <category><![CDATA[work]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Mon, 17 Aug 2026 02:42:38 GMT</pubDate>
            <atom:updated>2026-08-17T02:42:38.880Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Weather App For Android Wear OS Using Compose]]></title>
            <link>https://ngengesenior.medium.com/weather-app-for-android-wear-os-using-compose-662b35bf760c?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/662b35bf760c</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-wear]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Wed, 02 Oct 2024 05:24:38 GMT</pubDate>
            <atom:updated>2024-10-02T05:24:38.581Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w9-7KQ9y3mrryuof6Pf1ug.png" /><figcaption>Screenshot of app</figcaption></figure><p>Hi there,</p><p>I recently got a Pixel 2 Watch and wanted to get my hands dirty, so I tried replicating part of the stock weather app that comes with it. The app should be able to run on any Android watch.</p><h3>Features</h3><ul><li>Request watch’s current location using play services</li><li>Make API request to Open weather maps API and retrieve response</li><li>Display current condition and clicking on the screen takes one to details.</li></ul><p>For more, you can check the <a href="https://github.com/ngengesenior/Weather-Android_Wear">repo</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=662b35bf760c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Drawing a Pie Chart Using Jetpack Compose]]></title>
            <link>https://ngengesenior.medium.com/drawing-a-pie-chart-using-jetpack-compose-018347190b90?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/018347190b90</guid>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[charts]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Sat, 24 Aug 2024 16:17:52 GMT</pubDate>
            <atom:updated>2024-08-24T16:24:22.677Z</atom:updated>
            <content:encoded><![CDATA[<p>There are a couple of charting compose libraries but you may want to get your hands on understanding how some of the shapes are drawn. In this post, let us see how a simple pie chart can be drawn using Compose Canvas. This will be done in two parts;</p><ul><li>Drawing without animations</li><li>Animating the draw operations</li></ul><h4>The Pie Chart Concept</h4><p>A circle&#39;s total angle measure is 360 degrees and you are given a list of numeric values to draw a pie chart on paper, this is how you proceed;</p><ol><li>Calculate the sum of the values</li><li>For each value, the sweep angle(circular angle it will cover) is calculated by dividing each value by the total and multiplying by 360.</li><li>Draw each arc covered starting from an initial start angle.</li></ol><p>For Compose, we will use the Canvas composable alongside the drawArc function.</p><p>Start by defining a data class to hold an Item representing a value representing values on a pie chart.</p><pre>data class Item(<br>    val name: String, val value: Float,<br>    val color: Color<br>)<br><br>val sampleItems = listOf(<br>    Item(&quot;Item 1&quot;, 2f, Color.Blue),<br>    Item(&quot;Item 2&quot;, 4f, Color.Red),<br>    Item(&quot;Item 3&quot;, 5f, Color.Green),<br>    Item(&quot;Item 4&quot;, 3f, Color.Yellow),<br>    Item(&quot;Item 5&quot;, 8f, Color.Magenta),<br>)</pre><p>Let us proceed by drawing our pie chart.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/140624b64994c0123c7e17243c785d90/href">https://medium.com/media/140624b64994c0123c7e17243c785d90/href</a></iframe><p>We start with a start angle of -90 degrees and for each item on our items list, call drawArc and use its color as the color to use in drawing its arc, after each draw, add the current sweep angle to the start angle to be used as the next draw operation’s start angle. You should have the following shape.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*TdlNamQwv49ygebsbQg7Zw.png" /><figcaption>Pie Chart</figcaption></figure><h4>Animating the Draw Operations</h4><p>For the animation, we intend to animate the sweep angle, so we will use a list of Animatable’s that will all be initialized to zero. We will then proceed by using a LaunchedEffect and animate the values to the target sweep angle for each angle. That is all the change required.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e18eba1e44756c86d6015ab250cf8a29/href">https://medium.com/media/e18eba1e44756c86d6015ab250cf8a29/href</a></iframe><p>You should see this as shown in the video.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F_FKpX22f5iY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2F_FKpX22f5iY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F_FKpX22f5iY%2Fhq2.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f6d3bf9dc0ce11e0d53f150537da97c/href">https://medium.com/media/4f6d3bf9dc0ce11e0d53f150537da97c/href</a></iframe><p>You can try switching between different animations and see the effect, and you should see a smooth transition as the chart is drawn.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=018347190b90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Requesting the Current Location of iOS device from Kotlin using Compose Multiplatform.]]></title>
            <link>https://ngengesenior.medium.com/requesting-the-current-location-of-ios-device-from-kotlin-using-compose-multiplatform-f7f0b6f6bbc4?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7f0b6f6bbc4</guid>
            <category><![CDATA[location-services]]></category>
            <category><![CDATA[runtime-permissions]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Thu, 13 Jun 2024 03:48:21 GMT</pubDate>
            <atom:updated>2024-06-13T03:48:21.458Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*TwPkzdAlytZ6b7H34RfE7Q.png" /></figure><p>In this blog post, we will see how we can use Apple’s <a href="https://developer.apple.com/documentation/corelocation">CoreLocation</a> APIs to request the user’s current location using Kotlin. essentially we do not need to write a Swift library, but given that Kotlin multiplatform interoperates with most Apple APIs, we can safely call them within Kotlin.</p><p>The steps required for doing this are as follows:</p><ol><li>Create a Compose multiplatform project on the <a href="https://kmp.jetbrains.com/">Kmp website</a></li><li>Create a LocationManager class that implements the <a href="https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate">CLLocationManagerDelegate</a> protocol and extends <a href="https://developer.apple.com/documentation/objectivec/nsobject">NSObject</a> in the iOS source set.</li><li>Override CLLocationManager protocol functions and request permissions.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b38869f09c6ecd2dae568442e607663c/href">https://medium.com/media/b38869f09c6ecd2dae568442e607663c/href</a></iframe><p>The Apple APIs are imported through platform.* and we have a simple enum with three states depending on whether the location authorization has been accepted by the user, has been denied or is restricted or the user has accepted one of the required permissions. Most importantly, a CLLocationManager object is created and the current class is set as its delegate and the location manager&#39;s desired accuracy is set to the best accuracy in init .</p><p>Two <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-cancellable-continuation/">CancellableContinuation</a> , one which holds the status of the location authorization and one which holds the result which could be a CLLocation object. Let us proceed to write the crucial code that is requesting authorization.</p><h4>Requesting Location Services Authorization</h4><p>Start by going to the iOS app source set and add two keys and values in Info.plist for the appropriate message that will be shown to the user when the authorization for location services prompt is shown.</p><pre>&lt;key&gt;NSLocationWhenInUseUsageDescription&lt;/key&gt;<br>    &lt;string&gt;Location permission request to get weather for your location&lt;/string&gt;<br>&lt;key&gt;NSLocationAlwaysUsageDescription&lt;/key&gt;<br>  &lt;string&gt;Location permission request to get weather for your location&lt;/string&gt;</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0806600b88eba5e1f43efec0250d145a/href">https://medium.com/media/0806600b88eba5e1f43efec0250d145a/href</a></iframe><p>When you request authorization from the iOS location manager if the authorization to use the device location has not been shown to the user before, then its status is not determined, we can go ahead and request the authorization using requestWhenInUseAuthorization() which requests that the app gets access to the app only when in use, if the app is restricted from using the location or the user denies the request, we resume locationPermissionStatusCancellableContinuation with the value RESTRICTED_OR_DENIED , else if the user grants authorization to the app to use location services, our app receives with kCLAuthorizationStatusAuthorizedWhenInUse or kCLAuthorizationStatusAuthorizedAlways and we resume our continuation with LocationPermissionStatus.ACCEPTED to signal that the authorization was accepted.</p><h4>Requesting Current Device Location</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e254903fba5bc266ae158517ff9ad18/href">https://medium.com/media/6e254903fba5bc266ae158517ff9ad18/href</a></iframe><p>The main call to CLLocationManager’s requestLocation method will deliver a single CLLocation to us if it succeeds. We ensure that the created continuation is assigned to locationResultContinuation.</p><h4>Overriding locationManager functions</h4><p>We will implement override three locationManager functions which will deliver our continuations different values for the LocationPermissionStatus and CLLocation accordingly. The first method to override tells our delegate when authorization status changes. The equivalent Swift method is <a href="https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate/locationmanager(_:didchangeauthorization:)">here</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c184888b7e899facb41f99e8d7b30a6/href">https://medium.com/media/4c184888b7e899facb41f99e8d7b30a6/href</a></iframe><p>Each time the authorization status changes, we resume our continuation with the appropriate value for LocationPermissionStatus.</p><p>The next function override handles situations when the location manager fails to retrieve a value, thus in this case we resume our status with RESTRICTED_OR_DENIED and the location result continuation with an exception. The equivalent Swift function is <a href="https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate/locationmanager(_:didfailwitherror:)">here</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b53eca0e37de38b0d04fae3ed4bfb4d/href">https://medium.com/media/6b53eca0e37de38b0d04fae3ed4bfb4d/href</a></iframe><p>The next override delivers new a list of CLLocations to the delegate when location data is available. In this case, we verify that at least a valid location is found and resume the location result continuation. The equivalent Swift method is <a href="https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate/locationmanager(_:didupdatelocations:)">here</a>. The location data is delivered in didUpdateLocations.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/943a36fc493576c7f8c5a69140660fab/href">https://medium.com/media/943a36fc493576c7f8c5a69140660fab/href</a></iframe><p>At this point, the full class should be as follows.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d729c38fbc09191ca7b91c425cc419a/href">https://medium.com/media/0d729c38fbc09191ca7b91c425cc419a/href</a></iframe><p>The CVLocation.coordinate field returns a <a href="https://developer.apple.com/documentation/corelocation/cllocationcoordinate2d">CLLocationCoordinate2D</a> Swift struct which has the latitude and longitude. We will destructure this structure to have the equivalent values using two extension functions.</p><pre>import kotlinx.cinterop.ExperimentalForeignApi<br>import kotlinx.cinterop.useContents<br>import platform.CoreLocation.CLLocation<br><br>@OptIn(ExperimentalForeignApi::class)<br>fun CLLocation.getLatitude(): Double = this.coordinate().useContents { latitude }<br>fun CLLocation.getLongitude(): Double = this.coordinate().useContents { longitude }</pre><p>At this point, let us test this by this in a Composable specific to the iOS source set.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1d77519bf16b9ce576d2046da66244f/href">https://medium.com/media/a1d77519bf16b9ce576d2046da66244f/href</a></iframe><p>When the composable is entered, we use a LauchedEffect to trigger the requestPermission method from our IosLocationManager class and depending on the status, we verify if a location was retrieved.</p><p>Running the composable for the first time shows a dialog to show the authorization dialog to the user and if a user selects the options Allow Once or Allow While Using App, the next screen gets the user’s current longitude and latitude else, it displays that they permission was denied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*TwPkzdAlytZ6b7H34RfE7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*Hn8l8x7qY4mq6jGVaNd1uQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ToJhE3pQz7YzYS4K51i2Ww.png" /><figcaption>Running Composable on iPhone</figcaption></figure><p>Well, we have successfully been able to complete the task. Congrats.</p><p>NB: I am from the Android ecosystem, and I am used to saying permissions unlike iOS land which uses authorization, so here, I use them interchangeably 😆.</p><p>I hope you felt like a superstar writing iOS code without using Swift .</p><h4>Useful link</h4><p><a href="https://kotlinlang.org/docs/native-objc-interop.html">https://kotlinlang.org/docs/native-objc-interop.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7f0b6f6bbc4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Losing My Lifeline: The Remote Job Casualty of Cameroon’s Connectivity Issues]]></title>
            <link>https://ngengesenior.medium.com/losing-my-lifeline-the-remote-job-casualty-of-cameroons-connectivity-issues-3921ba6e9cc3?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/3921ba6e9cc3</guid>
            <category><![CDATA[starlink]]></category>
            <category><![CDATA[internet]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Sat, 06 Apr 2024 15:39:05 GMT</pubDate>
            <atom:updated>2024-04-06T15:39:05.350Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cYZHg31sEs8T2ii6" /><figcaption>Photo by <a href="https://unsplash.com/@comparefibre?utm_source=medium&amp;utm_medium=referral">Compare Fibre</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This isn’t just another rant. It’s a story of how unreliable internet connectivity in Cameroon, particularly from major providers, cost me a significant remote role in 2023.</p><p>In late 2022, I landed a remote technical writing job I was thrilled about. The role offered a starting salary of $1,200 (approximately XAF 700,000 at the time) with an additional $100 per month for internet. Determined to secure a stable connection, I opted for Camtel’s fiber optic service.</p><p>Following the standard procedure, I visited their Buea branch and submitted an application. Days turned into weeks with no response. Frustrated, I resubmitted the application, only to face the same silence. On my third visit, the secretary suggested a “grease the wheels” of XAF 70,000. Desperate to avoid jeopardizing my new role, I paid.</p><p>The internet was installed within a week, but the euphoria was short-lived. It stopped working entirely after just two hours. Calls to Camtel went unanswered. By this point, I’d spent roughly XAF 150,000.</p><p>Further investigation revealed they’d connected me to another customer’s line, explaining the abrupt outage. To add insult to injury, the technicians who did the installation were out of town, leaving me stranded. Countless calls later, they finally resolved the issue. However, my internet woes continued.</p><p>Regular meetings are crucial in a remote role. Unfortunately, these became a nightmare due to constant internet blackouts. Excuses grew thin as the company understandably questioned how I couldn’t secure stable internet despite their $100 contribution.</p><p>Seeking a solution, I purchased a backup modem from Orange Cameroon for XAF 40,000. Disappointingly, the problems persisted. I was essentially paying for unreliable internet from both Camtel and Orange. MTN Cameroon wasn’t an option either. Their slow 125Kbps service prompted me to cancel after two months of frustration in 2022 despite paying XAF 25,000 monthly.</p><p>These issues ultimately led to me losing the job after only three months. This wasn’t my first experience with unreliable internet, and the constant struggle is a major embarrassment when working remotely. It feels deliberate, almost like these telecom companies are intentionally hindering progress.</p><p>There’s a growing interest in Starlink as an alternative. It’s no surprise, then, that the Ministry of Post and Telecommunications is pushing for a ban. Instead of improving their services, they’d rather stifle competition. This speaks volumes about the state of internet accessibility in Cameroon. It seems the big players want to keep people dependent on their subpar services.</p><p>I’m just one person who lost a livelihood. There are countless others facing the same struggle. The push to ban Starlink, a potentially more affordable option, only highlights the deliberate tactics these unreliable providers may be employing.</p><p>Bye!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3921ba6e9cc3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Fell for a Credit Card Scam]]></title>
            <link>https://ngengesenior.medium.com/i-fell-for-a-credit-card-scam-f4682ddd4e56?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4682ddd4e56</guid>
            <category><![CDATA[scam]]></category>
            <category><![CDATA[scams-to-avoid]]></category>
            <category><![CDATA[scam-alert]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Tue, 30 Jan 2024 20:35:38 GMT</pubDate>
            <atom:updated>2024-01-30T20:37:51.834Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K9-JfYGg9u77nKqx" /><figcaption>Photo by <a href="https://unsplash.com/@moneyphotos?utm_source=medium&amp;utm_medium=referral">rc.xyz NFT gallery</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I did not want to tell this story because I got ashamed after falling for it but I am sure someone out there might learn from the cheap scam.</p><h4>The Scam Detective</h4><p>On a normal day, I am usually the one advising others on how to stay away from scams. I have friends who whenever they come across a message shared and links, will send it to me to check it for them if it is a scam and I am always damn good at it. To add to my scam detective skills, I was once sent an MLM scheme and I pointed out that it was a scam and it would crash and within two weeks, it crashed. The reason I am telling you all this is to explain that despite my abilities, I still fell for a scam.</p><h4>The Scam</h4><p>Some weeks ago, while at home, I received an SMS, telling me that my address was wrong and that I should update my address on USPS, or else my package would be delivered late or at a later date. Surprisingly, I had bought something on eBay and I was expecting it that day or the next and without a thought, I who usually checks all links, went ahead and clicked the link without checking and it took me to a website with the exact design as USPS. I went ahead to fill in my address and the next page came up that I had to pay $0.3 for the delay in my head, that was nothing and I filled in my credit card details and an OTP was sent by my bank and I filled it as well, only to receive an email 1.5 minutes later that my card has been successfully added to Apple Pay 😆.</p><h4>You Got In a Mess, Now Find a Solution</h4><p>I immediately suspected foul play. I did not pay with Apple Pay nor did I add my card to a new iOS device. Well, I immediately went to my bank app and locked the card. I was also contacted immediately by Bank of America, which came as a surprise to me as to how quickly they had detected the scam on their end without me reporting it. They reached out to me while I was locking the card(roughly three minutes after the incident) and asked me if anyone had contacted me about a certain shipping and I was stunned. I was instructed to destroy the card and that a new one would be shipped to me.</p><h4>Aftermath</h4><p>I was very pissed after realizing what had happened and how badly I acted without verifying the link I clicked. Someone used a <em>.online</em> domain to fool me and I did not realize it. I was silly and they played me badly. My main issue is that I do not still know where someone got the info that I was expecting something I bought and used that to attempt to steal from me.</p><h4>Conclusion</h4><p>Be safe before you fall like me(though I did not lose a dime 😃). Take care of yourselves.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4682ddd4e56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Content Credentials(C2PA) to Audio Recordings Using SimpleC2PA.]]></title>
            <link>https://ngengesenior.medium.com/adding-content-credentials-c2pa-to-audio-recordings-using-simplec2pa-3ce64033a93c?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ce64033a93c</guid>
            <category><![CDATA[content-authenticity]]></category>
            <category><![CDATA[content-credentials]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Thu, 18 Jan 2024 06:30:01 GMT</pubDate>
            <atom:updated>2024-01-25T15:35:39.244Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*NwqeHqnjNNvUCWb9gCznhA@2x.jpeg" /></figure><p><a href="https://c2pa.org/">C2PA</a> stands for Coalition for Content Provenance and Authenticity which addresses the prevalence of misleading information online through the development of technical standards for certifying the source and history (or provenance) of media content. C2PA is a <a href="https://jointdevelopment.org/">Joint Development Foundation</a> project, formed through an alliance between Adobe, Arm, Intel, Microsoft, and Truepic.</p><p>How do you determine that a photo you are viewing on the internet was captured or is AI-generated? How do you determine that at some point, it was edited before being shared online? Is this audio or video I am watching even real or AI-generated? It is hard to tell what is real these days and the <a href="https://contentauthenticity.org/">Content Authenticity Initiative</a> led by Adobe seeks to address these issues.</p><h4>How Does C2PA Work?</h4><p>Imagine this: you take a photo of the La Nouvele Liberté in Douala, edit it in Photoshop, and share it online. Someone else downloads your picture, modifies it further, and then posts it again. How do you track the evolution of this image, seeing what changes were made at each step? Here’s where C2PA comes in.</p><p><strong>Capturing the Journey:</strong></p><ul><li>C2PA-enabled cameras and software can embed information like location, photographer, and device at the moment of capture. Think of it as tagging the moment of birth.</li><li>Editing software equipped with C2PA allows users to record the changes they make, like turning a sunny sky into a stormy one. It’s like documenting the photo’s life story. The editor has to opt-in to allow C2PA to capture the edits made.</li></ul><p><strong>Verifying the Story</strong>:</p><ul><li>When you encounter a C2PA-tagged image(or media) online, an icon acts as a “truth detector.” Click it, and you’ll see the entire journey of the photo: from its birth through all edits.</li><li>Each step is <em>cryptographically signed</em>, like a secure digital fingerprint. It ensures the information hasn’t been tampered with, making C2PA more reliable than standard photo data (EXIF).</li></ul><p><strong>The Power of Transparency</strong>:</p><ul><li>C2PA empowers viewers to judge the authenticity of media. You can see if a photo, video, audio or other media has been manipulated and understand its context better.</li><li>This transparency helps combat misinformation and fake news, ultimately building trust in the online world.</li></ul><h4>The Technical Part: Adding Dependencies to the Android Studio Project</h4><p>The <a href="https://proofmode.org/">ProofMode team</a> (which I am a part of) worked on compiling the C2PA Rust SDK to get it working on Android Kotlin, and iOS. Note that the main focus of this article is how to use the compiled Android version to integrate C2PA with audio files.</p><p>Start by adding the Simple C2PA Android dependency</p><pre>implementation(&quot;info.guardianproject:simple_c2pa:0.0.7&quot;)<br> implementation(&quot;net.java.dev.jna:jna:5.13.0@aar&quot;)</pre><p>As stated, C2PA works by embedding a manifest into the media file during capture or whenever an edit is made and the device, editing software is running C2PA.</p><h4>Create Private Keys and Certificates for Signing C2PA Data</h4><p>The first step starts with creating private keys and certificates using a sample Kotlin function as below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6e847a94b494b49b2f0a60511268940/href">https://medium.com/media/e6e847a94b494b49b2f0a60511268940/href</a></iframe><p>The classes such as FileData, and Certificate, and methods like createPrivateKey and createCertificate are all from the Simple C2PA library. and we will use the keys and certificates to sign our captured audio file.</p><blockquote>At the time of this writing, audio file support is only possible for <strong>.wav</strong> and <strong>m4a</strong> extensions.More extensions support will come as C2PA development progresses.</blockquote><h4>Adding Content Credentials to Captured Audio</h4><p>To generate content credentials for the file, we need the input file and the output file to be generated(if you wish to replace the input file, the output file should be the same), and properties such as whether we want to allow machine learning training on our file or not, the fingerprint, email display and other app properties. Using the user certificate created in the function <em>initCredentials</em>, we create content credentials for the input file and add various assertions which are the actual content credentials. The assertions that can be added to content credentials include;</p><ul><li>Email assertion</li><li>Machine learning assertion whether to restrict or permit machine learning on our resulting output file.</li><li>Exif assertion which includes data such as the device used, GPS coordinates, etc; is separate from the Exif data we have from Android, though it has similar attributes.</li><li>More assertions can be seen in the info.guardianproject.simple_c2pa.ContentCredentials class.</li></ul><p>When the assertions have been added, call the function embedManifest of the ContentCredentials class passing the absolute file path of the output file. This is the most crucial step given that without calling this method, content credentials will not be added to the file. An implementation is shown below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e81ac8d7fede508eb3800a295b010b0/href">https://medium.com/media/6e81ac8d7fede508eb3800a295b010b0/href</a></iframe><p>Before adding the various assertions, we verify if the user certificate already exists, and if it does not exist, we initialize it as shown in the above snippet, as it is the certificate we will use to create the content credentials object.</p><p>Given that the above source code uses a Java File object, given an audio file path, we use the file path to create the input file required and call the function above.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ff54fb86f4bb7e4fb9ee6940f3261c7/href">https://medium.com/media/2ff54fb86f4bb7e4fb9ee6940f3261c7/href</a></iframe><p>The generateContentCredentials method returns the resulting output audio file with C2PA embedded. We can simply use an Android Share Intent to save the resulting file and can use the content credentials <a href="http://contencredentials.org/verify"><em>verify tool </em></a>to see the content credentials associated with this file.</p><p>The above source code is based on <a href="https://github.com/guardianproject/AudioRecorder-ProofMode">ProofMode Audio Recorder</a> maintained by the ProofMode team. You can check <a href="https://github.com/ngengesenior/AudioRecorder-ProofMode/tree/proof-generation-sharing">this branch</a> for the full source code.</p><p>The following screenshots show an audio file generated from ProofMode Audio Recorder which has been uploaded to the verify tool and the content credentials of the audio file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1SvKKrlHbU_FWR-1k_HRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*UJAKOH2DZpn5KJfUBMVmIQ.png" /><figcaption>Content credentials info of audio file.</figcaption></figure><p>As you can see, the verify tool shows details about who captured the media, their fingerprint, the location of capture, the device used, etc. You may also have seen the ‘This Content Credential was issued by an unknown source’ message in the screenshot above. This is happening due to the fact that the claim signing key and certificate used in this demo is self-signed, and not linked to any trusted root certificate authority. For some use cases, that is acceptable, in others maybe not. We will cover key and identity management within C2PA in another future post.</p><p>For more on the progress of C2PA, check the websites <a href="https://contentauthenticity.org/">https://contentauthenticity.org/</a> , <a href="https://opensource.contentauthenticity.org/">https://opensource.contentauthenticity.org/</a> , <a href="https://contentcredentials.org/">https://contentcredentials.org/</a> .</p><p>To learn more about all of the ways that ProofMode supports C2PA, please visit <a href="https://proofmode.org/c2pa">https://proofmode.org/c2pa</a>.</p><p>Thank you and leave your thoughts in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ce64033a93c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reach Your Goals by Failing]]></title>
            <link>https://ngengesenior.medium.com/reach-your-goals-by-failing-c131c93d16c6?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/c131c93d16c6</guid>
            <category><![CDATA[techies]]></category>
            <category><![CDATA[failure-to-success]]></category>
            <category><![CDATA[failure-stories]]></category>
            <category><![CDATA[failures-in-life]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Tue, 31 Oct 2023 22:27:00 GMT</pubDate>
            <atom:updated>2023-10-31T22:41:55.818Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tILP8XsnNooe-2gIOFPgMA@2x.jpeg" /><figcaption>Photo by the blowup on Unsplash</figcaption></figure><p>This might not be one of the most suitable titles for this post but we will go for it anyways. It comes from my own experience specifically with academics.</p><p>I started primary school not being even an average student when it came to class performance and I even repeated “Class One” because of poor performance but after reaching primary three, somehow I became a bright student and picked up really quickly with spellings and that is when my success with academics started. I was always top of the class my whole time from primary three to primary 5 in Government Primary School, Binshua, Donga Mantung Cameroon and I even remember a particular term maybe in primary five when I was the only person who passed(not that I was stingy with answers, maybe my peers didn’t know how to steal answers 😅). Though I attended primary six in a primary school with other tough guys at Good Foundation Primary Foumbot, I still used to come in third or fourth in class and that was still a lot. Fast forward after entering secondary school, I continued toping the class all through my secondary school years. I groomed myself to succeed academically and of course, it had its repercussions.</p><p>I got so used to succeeding academically that I was scared of failing and failure changed my whole perspective. I had my first major failure when I applied to study software engineering at the Faculty of Engineering and Technology, University of Buea. I had applied only to the particular faculty, after all, I had scored 21/25 points at the GCE Advanced Level and I was confident I would be selected, but to my greatest surprise, I was rejected. This had a great effect on me as I was down psychologically for almost three weeks. I started asking myself a lot of questions, which sounded stupid, most of my peers had started going to school and I was still home not knowing what to do next, and started feeling like I was a failure. Somehow I got past that stage and applied to study Computer Science at the same University. I was so concentrated on passing as I was pressured by the notion people had of me in secondary and primary school that I was an intelligent guy. Anyway, I became used to “passing exams again” and though it was tough, I did great the first year and the first semester of year two.</p><p>The next episode kicked in in 2017 we as the first batch of Computer Science were supposed to graduate but I had not completed all my courses. At that point, I did not really care very much about passing exams anymore, I was not scared to be tagged “Hey that intelligent guy didn’t graduate”. In fact, I was not scared of “failure” anymore as I decided that rather than passing exams only, I had to gain real skills, I could not see myself graduating and applying for a role at some company and not being able to defend myself as a techie. I took time and studied software development specifically Android development much harder from then on and blended with school at this point, I was focusing some time to pass my courses and a lot of energy into actually knowing what I was pursuing as a career. This seemed like a detriment to my academics but it is still one of the best life decisions I made in my life. I graduated a year later with Second Class Honours(Lower Division 😏) and at that point, I was not really bothered so much. I had learned to fail for better success.</p><p>What is the rationale behind what I am saying? Most people who succeed in some domains especially academics are not used to failures and they get scared of taking chances/opportunities in which they may not succeed, they stay in their shallow success lane and essentially tell themselves that they are succeeding after all. Just get comfortable with failing(do not make it a habit) though but ensure that you find you rise when you fail. The only way I succeeded( I am not blown yet please) at least was to get used to failing or delay as it will not kill you but make you stronger. I have not arrived and I do still study Android development week after week to show myself approved. You might want to find your own niche.</p><p>It took a little courage for me to pen this down since I have not been blogging a lot, so do share and comment if you find this enlightening.</p><p>Okay Bye.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c131c93d16c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seamlessly Switching Camera Lenses During Video Recording with CameraX on Android.]]></title>
            <link>https://ngengesenior.medium.com/seamlessly-switching-camera-lenses-during-video-recording-with-camerax-on-android-fcb597ed8236?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcb597ed8236</guid>
            <category><![CDATA[camerax]]></category>
            <category><![CDATA[cameras]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Sat, 09 Sep 2023 07:38:23 GMT</pubDate>
            <atom:updated>2023-09-09T08:09:26.434Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4hIDIyTqIdR3E1NI" /><figcaption>Photo by <a href="https://unsplash.com/@angelacompagnone?utm_source=medium&amp;utm_medium=referral">Angela Compagnone</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>One of the features of Snapchat that I have always been thinking about and trying to understand is how the app is able to switch between the front and back camera lenses during an ongoing recording.</p><p>One possible implementation that was suggested was to temporarily save a record when the lens is switched and at the final recording, join all the videos involved into a single video and delete the individual videos. This obviously sounds like a good plan but I guess you just want to switch between both lenses as a developer without all this hassle. Let us go.</p><h4>1. Create a Project in Android Studio</h4><p>Start by creating a new project in Android Studio and add the CameraX dependencies of at least version 1.3.0-beta01but in this demonstration, I use the version 1.3.0-rc01.</p><pre>dependencies {<br>// CameraX dependencies<br>def camerax_version = &quot;1.3.0-rc01&quot;<br>implementation &quot;androidx.camera:camera-core:${camerax_version}&quot;<br>implementation &quot;androidx.camera:camera-camera2:${camerax_version}&quot;<br>implementation &quot;androidx.camera:camera-lifecycle:${camerax_version}&quot;<br>implementation &quot;androidx.camera:camera-video:${camerax_version}&quot;<br>implementation &quot;androidx.camera:camera-view:${camerax_version}&quot;<br>implementation &quot;androidx.camera:camera-extensions:${camerax_version}&quot;<br>// To use .await() on camera provider future suspend function<br>implementation &quot;androidx.concurrent:concurrent-futures-ktx:1.1.0&quot;<br><br>// other android dependencies<br><br>}</pre><p>2. Make sure to add CAMERA and RECORD_AUDIO permissions in your app’s AndroidManifest.xml file.</p><pre><br><br>    &lt;uses-permission android:name=&quot;android.permission.CAMERA&quot; /&gt;<br>    &lt;uses-permission android:name=&quot;android.permission.RECORD_AUDIO&quot; /&gt;</pre><p>3. I will assume you know how to request runtime permissions and leave that for you and focus on the main topic.</p><p>Create your view layout and inflate it with a PreviewView, a button for video recording, and a button for switching between the camera lenses.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;layout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;<br><br>    &lt;androidx.constraintlayout.widget.ConstraintLayout<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;match_parent&quot;<br>        tools:context=&quot;.PersistentRecordingActivity&quot;&gt;<br><br>        &lt;androidx.camera.view.PreviewView<br>            android:id=&quot;@+id/previewView&quot;<br>            android:layout_width=&quot;0dp&quot;<br>            android:layout_height=&quot;0dp&quot;<br>            app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>            app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>            app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>            app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;<br><br>        &lt;/androidx.camera.view.PreviewView&gt;<br><br>        &lt;Button<br>            android:id=&quot;@+id/buttonRecord&quot;<br>            android:layout_width=&quot;wrap_content&quot;<br>            android:layout_height=&quot;wrap_content&quot;<br>            android:layout_marginBottom=&quot;24dp&quot;<br>            android:text=&quot;@string/start_record&quot;<br>            app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>            app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>            app:layout_constraintStart_toStartOf=&quot;parent&quot; /&gt;<br><br>        &lt;ImageView<br>            android:id=&quot;@+id/imageViewFlipCamera&quot;<br>            android:layout_width=&quot;wrap_content&quot;<br>            android:layout_height=&quot;wrap_content&quot;<br>            android:layout_marginTop=&quot;16dp&quot;<br>            android:layout_marginEnd=&quot;16dp&quot;<br>            app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>            app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>            app:srcCompat=&quot;@drawable/flip_camera&quot; /&gt;<br><br>    &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;<br>&lt;/layout&gt;</pre><p>Next, in our Activity Kotlin file, we will initialize our variables which include recording,camera lens,Preview usecase,recorder and VideoCapture usecase.</p><pre>class PersistentRecordingActivity : AppCompatActivity() {<br>    private val binding: ActivityPersistentRecordingBinding by lazy {<br>        ActivityPersistentRecordingBinding.inflate(layoutInflater)<br>    }<br><br>    // Holds the current recording<br>    private var recording: Recording? = null<br><br>    private val preview: Preview by lazy {<br>        Preview.Builder().build()<br>    }<br><br>    private var cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA <br>   // Recorder to use with video capture usecase<br>    private val recorder: Recorder by lazy {<br>        Recorder.Builder().build()<br>    }<br>    private val videoCapture: VideoCapture&lt;Recorder&gt; by lazy {<br>        VideoCapture.withOutput(recorder)<br>    }<br><br>    private lateinit var cameraProvider: ProcessCameraProvider<br><br>override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br>        setContentView(binding.root)<br>        lifecycleScope.launch {<br>            // we will implement this<br>            startCamera()<br>        }<br>        // And this<br>        createClickListeners()<br>    }<br><br>}</pre><p>The recording variable holds the current recording which is null when the Activity is launched and the cameraSelector holds the current camera face which by default for us is the back Camera, the recorder variable is created and bound to the videoCapture use case. We used Kotlin’s by lazy delegate to initialize most of the variables, which we could still have done in the startCamera method. Let us see the startCamera .</p><pre>private suspend fun startCamera() {<br>        cameraProvider = ProcessCameraProvider.getInstance(this).await()<br>        preview.setSurfaceProvider(binding.previewView.surfaceProvider)<br>        cameraProvider.unbindAll()<br>        try {<br>            cameraProvider.bindToLifecycle(this, cameraSelector, preview, videoCapture)<br>        } catch (ex: Exception) {<br>            ex.printStackTrace()<br>        }<br>    }<br></pre><p>The startCamera method is a suspend function since we make use of .await() which is an extension of the androidx.cocunrrent library added that waits for a ListenableFuture to complete and return the type. To get the camera feed, we let the PreviewView’s surface be used as the surface of the preview use case. Without calling preview.setSurfaceProvider() , the camera feed will not be displayed. We complete the method by calling bindToLifeCycle method of ProcessCameraProvider and pass in the lifecycle, camera selector, and the two use cases. At this point, running the project should display the camera feed with the recording button and flip camera image view.</p><p>The method createClickListeners houses the two methods startRecording and flipCamera called respectively by the two views buttonRecord and imageViewFlipCamera</p><pre>private fun createClickListeners() {<br>        binding.apply {<br>            imageViewFlipCamera.setOnClickListener {<br>                flipCamera()<br>            }<br><br>            buttonRecord.setOnClickListener {<br>                startRecording()<br>            }<br><br>        }<br>    }</pre><h4>Start Persistent Recording</h4><p>In order for us to switch cameras while recording, we need to pause the current recording first and unbind all the use cases, then when the new camera lens is ready, we bind the new camera lens along with the Preview and VideoCapturecases but for this to be possible, we must create the recording as a persistent recording, so that audio data is captured after we unbind the use cases. Below is the startRecording method implementation.</p><pre>@OptIn(ExperimentalPersistentRecording::class)<br>    private fun startRecording() {<br>        if (recording == null) {<br>            val contentValues = ContentValues().apply {<br>                put(MediaStore.Video.Media.DISPLAY_NAME, System.currentTimeMillis())<br>                put(MediaStore.Video.Media.MIME_TYPE, &quot;video/mp4&quot;)<br>                put(MediaStore.Video.Media.RELATIVE_PATH, &quot;DCIM/CameraX&quot;)<br>            }<br>            val outputOptions = MediaStoreOutputOptions.Builder(<br>                contentResolver,<br>                MediaStore.Video.Media.EXTERNAL_CONTENT_URI<br>            )<br>                .setContentValues(contentValues)<br>                .build()<br>            recording = recorder.prepareRecording(this, outputOptions)<br>                .asPersistentRecording() // Audio data is recorded after the VideoCapture is unbound<br>                .withAudioEnabled()<br>                .start(<br>                    ContextCompat.getMainExecutor(this)<br>                ) { recordEvent -&gt;<br>                    when (recordEvent) {<br>                        is VideoRecordEvent.Start -&gt; {<br>                            binding.buttonRecord.text = getString(R.string.stop_record)<br>                        }<br><br>                        is VideoRecordEvent.Finalize -&gt; {<br>                            binding.buttonRecord.text = getString(R.string.start_record)<br>                        }<br><br>                    }<br><br><br>                }<br><br>        } else {<br>            recording?.stop()<br>            recording = null<br>        }<br><br><br>    }</pre><p>Each time buttonRecord is called, we either start recording(create a persistent recording) or stop the current recording. If it is a new recording, we have a reference to it and that is what we use later when we switch Camera lenses while recording. Next, let us see the flipCamera method.</p><pre>private fun flipCamera() {<br>        // change the Camera lens<br>        cameraSelector = if (cameraSelector == CameraSelector.DEFAULT_BACK_CAMERA) {<br>            CameraSelector.DEFAULT_FRONT_CAMERA<br>        } else {<br>            CameraSelector.DEFAULT_BACK_CAMERA<br>        }<br>        // verify if there is a current recording<br>        if (recording != null) {<br>            recording?.pause()<br>            cameraProvider.unbindAll()<br><br>            cameraProvider.bindToLifecycle(this, cameraSelector, preview, videoCapture)<br>            recording?.resume()<br><br>        } else {<br>            cameraProvider.unbindAll()<br>            cameraProvider.bindToLifecycle(this, cameraSelector, preview, videoCapture)<br>        }<br>    }</pre><p>The above method is called in two scenarios, either while a recording is in progress or no recording is in progress. When there is no current recording ongoing, we query the current camera selector, change it, unbind all the use cases, and rebind the use cases with the new camera selector. When there is an ongoing recording, since we created the recording as a persistent recording, we must first pause the recording, unbind the use cases, then rebind the use cases, and finally resume recording.</p><pre>Note that in order to stop a persistent recording, we must explicitly<br> call recording.close() or recording.stop()</pre><p>Below is the complete source code for the activity and note that you have to request the required runtime permissions before you are able to run this code and record video alongside audio.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c90745149b20bae9868b10240b6057d/href">https://medium.com/media/2c90745149b20bae9868b10240b6057d/href</a></iframe><p>For a demonstration, below is how the final app looks and a sample recorded video.</p><ul><li><a href="https://www.youtube.com/shorts/1FYlfwiwExM">CameraX switching Camera lens while recording</a></li><li><a href="https://www.youtube.com/shorts/NvQKh_W4jsc">CameraX switching lens while recording resulting video</a></li></ul><p>Okay then, this is where we come to a close. Let me know your thoughts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcb597ed8236" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating libProofMode Android into Audio Recorder app.]]></title>
            <link>https://ngengesenior.medium.com/integrating-libproofmode-android-into-audio-recorder-app-ece4466f6c63?source=rss-1977cc208376------2</link>
            <guid isPermaLink="false">https://medium.com/p/ece4466f6c63</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[proof]]></category>
            <dc:creator><![CDATA[Ngenge Senior]]></dc:creator>
            <pubDate>Mon, 22 May 2023 16:22:35 GMT</pubDate>
            <atom:updated>2023-05-26T21:44:08.960Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C2Dn2Gi1aBomib6-1WCrMw.png" /><figcaption>ProofMode Audio Recorder UI</figcaption></figure><p>A few months ago, I reported about <a href="https://ngengesenior.medium.com/integrating-proofmode-in-simple-camera-android-315b79394020"><strong>Integrating ProofMode in Simple Camera Android</strong></a>, and hinted that the ProofMode team was working on making it possible to also integrate ProofMode into audio apps, well we got to work and integrated the same library into <a href="https://github.com/guardianproject/AudioRecorder-ProofMode">ProofMode Audio Recorder</a> and it was a great success.</p><p>As with every app, I encountered a few difficulties/pitfalls while integrating libProofMode into the audio recorder app. Let us see the few difficulties first.</p><h4>Difficulty Faced</h4><ul><li><strong>POST_NOTIFICATIONS permission</strong>: Every audio recorder app needs to show a notification for the user to be able to carry out actions like pausing and stopping a current recording session and added on that, it needs to show a notification as well when audio is being played. With the usual changes in Android permissions, I had to deal with the new permission called <strong>POST_NOTIFICATIONS</strong> which is required for showing notifications on Android 13+. This was partly because I decided to make the <em>targetSdkVerion</em> and <em>compileSdkVersion</em> to be 33 since we want every Android user to be able to use the app without issues.</li></ul><h4>The Approach Used in Integration</h4><p>Following the same approach in the integration with the Simple Camera Android app, I started by creating a dedicated library for proof generation, adding libProofMode Android library dependency into the library.</p><pre>implementation &#39;org.witness:android-libproofmode:1.0.25&#39;<br>def work_version = &#39;2.8.1&#39;<br>implementation &quot;androidx.work:work-runtime-ktx:$work_version&quot;</pre><p>Next Android’s WorkManager APIs are used for the task. The worker in this case is very much the same as the one used in the Simple Camera app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c79735acc8e08b6c870b27471365f235/href">https://medium.com/media/c79735acc8e08b6c870b27471365f235/href</a></iframe><p>The worker gets the audio uri passed to it using its <strong><em>inputData</em></strong> and then uses it to generate the proof using the <em>ProofMode.generateProof(Context, Uri)</em> method from libProofMode library.</p><p>Given that the Audio Recorder app depends on saving the audio files primarily using the <em>File</em> APIs, we use FileProvider for getting the file Uri and as well, a method for creating the input data that is fed to the worker.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0386577efac0b22fad61209a8881d17/href">https://medium.com/media/c0386577efac0b22fad61209a8881d17/href</a></iframe><p>With the above code snippets, we are all set for the actual proof generation using WorkManager, so we create a static method that will use the concept from the above code snippets and create a <em>OneTimeWorkRequest</em> using the <em>GenerateProofWorker</em> worker.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31bb73b493684e6e1a239d9582c517cd/href">https://medium.com/media/31bb73b493684e6e1a239d9582c517cd/href</a></iframe><p>For every generated audio file, a call is made to <em>generateProofWithWorkManager</em> and we are good to go.</p><h4>What Can We Take Away from This?</h4><p>If you followed through, you must have noticed that for the proof generation with <em>libProofMode</em> Android, the main thing required is a file Uri and so, you can integrate it into any Android app that generates files. You are not tied to using only media files, and so for any use case that requires you to preserve proof, you can go ahead and integrate it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ece4466f6c63" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>