<?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 Fred Chung on Medium]]></title>
        <description><![CDATA[Stories by Fred Chung on Medium]]></description>
        <link>https://medium.com/@fredchung?source=rss-ac312b7e211e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WJUOebLbntJbftoJVRejog.jpeg</url>
            <title>Stories by Fred Chung on Medium</title>
            <link>https://medium.com/@fredchung?source=rss-ac312b7e211e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 18:10:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fredchung/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[Getting to know the behaviors of your SDK dependencies]]></title>
            <link>https://medium.com/androiddevelopers/getting-to-know-the-behaviors-of-your-sdk-dependencies-f3dfed07a311?source=rss-ac312b7e211e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3dfed07a311</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[android-apps]]></category>
            <dc:creator><![CDATA[Fred Chung]]></dc:creator>
            <pubDate>Tue, 30 Mar 2021 17:04:23 GMT</pubDate>
            <atom:updated>2021-03-30T17:04:23.145Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aivdcphhqgDBN7eg0CBcsg.jpeg" /></figure><p>You likely are using third-party SDKs or libraries in your app. After all, why build functionality from scratch if the building blocks are readily available and can save you time? As an app developer, you are responsible for the overall user experience and code shipped in your app, including those provided by any third-party SDKs.</p><p>When you’re considering SDKs and libraries, it’s important to learn about their handling and usage of data, so you can better protect your users’ privacy.</p><p>In this post, I’ll share several tools you can use during the different development stages of your app — including development time and post-launch. (Of course, this is complementary to SDK documentation, which you’re encouraged to read very carefully, line-by-line).</p><p><strong>Merged manifest view</strong></p><p>To offer flexibility, Gradle allows you to provide separate manifest declarations for your app’s build variants, app modules, and library dependencies. These manifest files could include different default XML elements and attributes based on your project’s needs. When building your app, Gradle merges this hierarchy of manifests into a single manifest for your app. You can <a href="https://developer.android.com/studio/build/manifest-merge">specify “merge rules”</a> to control how values are merged. Let’s check out how you could use this facility to gain insights into your SDKs.</p><p>Android Studio offers an easy way to inspect the final merged manifest. You can simply click on the “Merged Manifest” tab of your manifest’s editor window. Through the colored bands in the UI, you are able to identify the sources of different manifest elements. These sources include various library dependencies. For example, the view below shows that the dependency named “transport-backend” has included a couple of permissions in the app.</p><p>A sample merged manifest view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*RE29Rt9JXvRQdddP" /></figure><p>In particular, this increased visibility could help you spot any unexpected runtime permissions introduced by your app’s dependencies. This insight is useful not only because runtime permission dialogs could alter your app’s UX, but also because it makes you more aware of the data usage within your app’s dependencies. If appropriate, you should explain to your users when and why the access is necessary.</p><p>If you see any unexpected permissions in your merged manifest, carefully review the documentation (or contact the developer) of the libraries in question and make sure you understand why they’re needed.</p><p>It’s possible that such permissions are optional for the services that you’re actually using. In the interest of data minimization, you could use a “remove” <a href="https://developer.android.com/studio/build/manifest-merge#node_markers">node marker</a> in your app module’s manifest to prevent the libraries’ permissions from merging into your app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c0346a1f4cb4150e31a109f684d8217/href">https://medium.com/media/8c0346a1f4cb4150e31a109f684d8217/href</a></iframe><p><strong>Module dependency view</strong></p><p>Another useful facility in the development toolchain is Gradle’s module dependency support. One common use for dependency graphs is to troubleshoot build issues. The dependency graphs also include transitive dependency information, which can be helpful in identifying additional dependencies your libraries bring in. Learn more about <a href="https://developer.android.com/studio/build/dependencies.html#view-dependency-tree">viewing module dependencies</a>.</p><p>Let’s have a look at another tool that you can use to better understand data access in your app.</p><p><strong>Data access auditing</strong></p><p>As your app’s complexity (and your team size!) increases over time, it isn’t always straightforward to diagnose SDK-related private data access during the development phase of your app.</p><p>Android 11 introduces <a href="https://developer.android.com/guide/topics/data/audit-access">Data Access Auditing</a>, which helps identify which code performs data access operations as the app is used. This feature allows you to associate private data access with specific business use cases in your app, such as “order coffee” or “share with friends”. This could be useful to pinpoint any unexpected data access operations and identify which module or use case performs the access operation.</p><p>To implement, create a context object and associate it with an “attribution tag”, which corresponds with a business use case, say “order coffee”. You could do this inside OrderCoffeeActivity.onCreate().</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ae854cd58c9b7d4b236a805b52d33d2b/href">https://medium.com/media/ae854cd58c9b7d4b236a805b52d33d2b/href</a></iframe><p>You could use this attribution context as the Context parameter for subsequent framework API invocations.</p><p>Next, set up a callback, which will be triggered when private data access occurs. Inside the callback, you could refer to the attribution tag, retrieve the stack trace, or integrate with your app’s analytics solution for reporting purposes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4f4243ece7b7b47e1a7ffdef4489676/href">https://medium.com/media/f4f4243ece7b7b47e1a7ffdef4489676/href</a></iframe><p>Data Access Auditing includes support for both synchronous and asynchronous API calls and is available on Android 11 or newer devices. <a href="https://developer.android.com/guide/topics/data/audit-access">Learn more</a>.</p><p><strong>Wrap up</strong></p><p>The merged manifest tool, Gradle’s module dependency support, as well as the data access auditing APIs introduced in Android 11, are designed to give you additional insights into data access and behaviors in your app and SDK dependencies. This in turns allows you to provide better transparency for your users. You’re encouraged to integrate these tools into your existing workflows.</p><p>Additionally, if you’re distributing through the Google Play Store, be sure to check out related <a href="https://support.google.com/googleplay/android-developer/answer/10144311">user data policy</a> and verify that your SDK usage is compliant.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3dfed07a311" width="1" height="1" alt=""><hr><p><a href="https://medium.com/androiddevelopers/getting-to-know-the-behaviors-of-your-sdk-dependencies-f3dfed07a311">Getting to know the behaviors of your SDK dependencies</a> was originally published in <a href="https://medium.com/androiddevelopers">Android Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adapt your app for the latest privacy best practices]]></title>
            <link>https://medium.com/androiddevelopers/adapt-your-app-for-the-latest-privacy-best-practices-d7469a547314?source=rss-ac312b7e211e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7469a547314</guid>
            <category><![CDATA[permission]]></category>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[Fred Chung]]></dc:creator>
            <pubDate>Thu, 10 Sep 2020 20:03:20 GMT</pubDate>
            <atom:updated>2020-09-10T20:03:20.848Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mzx-wzsHjrpKtCJjG0sXwA.jpeg" /></figure><p>Android 11 final release is <a href="https://android-developers.googleblog.com/2020/09/android11-final-release.html">here</a>! This release builds upon the privacy improvements in previous releases, and provides even better control and transparency for users as well as guardrails to help apps handle data responsibly.</p><p>Many of these improvements reinforce modern best practices applicable to recent Android releases (they aren’t specific to Android 11!). In this article, we will examine 4 of these best practices to help you future-proof your design and plan for compatibility test cases.</p><ol><li>Handling content URI sharing</li><li>Incremental permission requests</li><li>Sensitive data access in the foreground</li><li>Using resettable identifiers</li></ol><p><strong>Give proper URI permissions to other apps.</strong></p><p>With the <a href="https://developer.android.com/preview/privacy/package-visibility">package visibility</a> change in Android 11, apps that target <strong>API level 30</strong> will have limited visibility to other installed packages on the device by default. This is designed to provide better accountability for apps to “see” other packages on the device.</p><p>To ease migration, an <a href="https://developer.android.com/preview/privacy/package-visibility-use-cases">implementation guide</a> is available for common use cases. In general, an app must have visibility (verified using the <a href="https://developer.android.com/reference/android/content/pm/PackageManager">PackageManager</a> API) to other installed packages in order to interact with them. This applies to, for example, starting a service or reading from a content provider that belongs to another app.</p><p>Your content provider’s access model likely involves sending an implicit intent as opposed to an explicit intent targeted to a given package. As a result, your design cannot assume the receiving app’s target API level, which determines whether the app is subject to package visibility restrictions on Android 11.</p><p>To ensure that the receiving app has visibility to your package and thus, can access any shared URIs, you need to include the FLAG_GRANT_READ_URI_PERMISSION and/or FLAG_GRANT_WRITE_URI_PERMISSION URI flag in the intent. Note that the write permission <strong>does not </strong>imply read access. Upon getting triggered by the intent, the receiving app will be granted temporary access to the URIs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b54165cb4939b996f7c5f85901a40f74/href">https://medium.com/media/b54165cb4939b996f7c5f85901a40f74/href</a></iframe><p>As you plan to update your app’s target SDK version (even to a version before Android 11), pay attention to cases that involve sharing content provider access with another app and make sure that proper URI permissions are granted. This is applicable regardless of the owner of the content provider.</p><p>Limiting the level of data access to what’s required by the task at hand is generally a good practice. Ideally, your content providers should already have proper sharing permissions for individual <a href="https://developer.android.com/guide/topics/manifest/provider-element#gprmsn">URI patterns</a>. If so, your content providers are already compatible on Android 11!</p><p><strong>Request permissions incrementally.</strong></p><p>This <a href="https://research.google/pubs/pub46261/">Android user study</a> shows that users are more likely to grant a permission if the request aligns with their expectations. Therefore it is best practice to <a href="https://developer.android.com/training/permissions/requesting">request permissions</a> in-context, when a feature in your app needs those permissions.</p><p><em>Top user permission grant reasons. Source: </em><a href="https://research.google/pubs/pub46261/"><em>Android user study</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3ype5k-a-T-yCQXV" /></figure><p>This is especially applicable to sensitive permissions like location access. Since Android 10, the platform has introduced a fine-grain location model which distinguishes foreground from background location access. Most location use cases only need foreground access, such as when the user is engaging with an activity.</p><p>In fact, Google Play has a <a href="https://support.google.com/googleplay/android-developer/answer/9799150">policy</a> restricting unnecessary background location access. To check where your app might be accessing background location, <a href="https://developer.android.com/training/location/background">go through this checklist</a>. If your app requires background location, such as for a geofencing use case, make sure that it’s critical to your functionality.</p><p>For applicable apps, they should request foreground location at first, then background location at a later time. This approach gives users the option to control the level of permission grants. Additionally, you may strategically display an explanation or design an appropriate UX, to provide additional context on how the user may benefit from granting an additional location permission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/0*Zr-mfyJG4PfcLyf2" /></figure><p>Android 11 enforces incremental location permission requests for apps that target <strong>API level 30</strong>. Any permission requests that include <strong>both</strong> foreground location (either fine or coarse) and background location permissions will be ignored and result in the following error message.</p><p>E/GrantPermissionsActivity: Apps targeting 30 must have foreground permission before requesting background and must request background on its own.</p><p><em>Note that any other non-location permissions in the same </em><em>requestPermissions() API call will be ignored as well.</em></p><p>As the requestPermissions API takes an array of permissions as an input parameter, you may have existing code that demonstrates the following patterns. You’re encouraged to audit and design an alternative user flow as necessary.</p><p>If ActivityCompat or frameworks API is used:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c7f00f1275fe36a7fe4c5437691df2e7/href">https://medium.com/media/c7f00f1275fe36a7fe4c5437691df2e7/href</a></iframe><p>Likewise, if the Jetpack Activity library is used:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66949e500a6b2c7f442aa99af07e0bc3/href">https://medium.com/media/66949e500a6b2c7f442aa99af07e0bc3/href</a></iframe><p><strong>Proper access to location, microphone, and camera.</strong></p><p>Android’s design encourages transparency when accessing sensitive data such as microphone, camera, and location. For example, apps can only use the microphone and camera while in the foreground, such as when the UI is visible to the user. This improves transparency, so users can make an informed decision on enabling related features.</p><p>If your app has existing foreground services that access sensitive data, be sure that the use case involves direct user interactions, where the user can control the task being performed. For example, in a video conferencing app, you may use a foreground service to support an active meeting session that involves microphone and camera access. There should also be an affordance for the user to start and stop the session, and thus the foreground service.</p><p>Additionally, your app must properly set the foregroundServiceType attribute to indicate usage of location, microphone, or camera. This gives the system visibility to apps that need the data and is a requirement for apps that target Android 11. Learn more about <a href="https://developer.android.com/preview/privacy/foreground-services">foreground service changes</a>.</p><p>You may declare the usage of multiple data types in the manifest.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c2d1a4ed3534666089644006707327e2/href">https://medium.com/media/c2d1a4ed3534666089644006707327e2/href</a></iframe><p>If your implementation is based on a <a href="https://developer.android.com/topic/libraries/architecture/workmanager/advanced/long-running">long-running worker</a> within WorkManager, it is in fact backed by a foreground service called SystemForegroundService. You should include the appropriate foreground service types in your app’s manifest, which will be merged with Jetpack library’s AAR <a href="https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/work/workmanager/src/main/AndroidManifest.xml?source=post_page---------------------------%2F%2F%2F%2F%2F%2F&amp;autodive=0%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F">manifest file</a>.</p><p>Include this element in your app’s manifest with proper foreground service types defined.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6455bd2d69b01b0e80a04e43c02ec006/href">https://medium.com/media/6455bd2d69b01b0e80a04e43c02ec006/href</a></iframe><p>When you promote the worker to run as a foreground service, you will need to pass the appropriate foreground service types into the ForegroundInfo object. These types must be the same as those defined in the merged manifest above, or a subset of them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f6dce487379b87aacfd67a7af561aa1a/href">https://medium.com/media/f6dce487379b87aacfd67a7af561aa1a/href</a></iframe><p><strong>Migrate off of non-resettable identifiers.</strong></p><p>The Android system uses a number of non-resettable hardware identifiers, such as the IMEI, to support various OS functionality. The durability and uniqueness of these identifiers make them unsuitable for most identification use cases due to privacy considerations.</p><p><a href="https://developer.android.com/about/versions/10/privacy/changes#data-ids">Since Android 10</a>, the system has limited access to various non-resettable identifiers. For example, only privileged system apps with the READ_PRIVILEGED_PHONE_STATE permission can access SIM hardware identifiers via the <a href="https://developer.android.com/reference/android/telephony/TelephonyManager#getSimSerialNumber()">getSimSerialNumber()</a> method. In Android 11, the system has further <a href="https://developer.android.com/about/versions/11/behavior-changes-all#privacy">restricted access </a>by applying similar restrictions to the <a href="https://developer.android.com/reference/android/telephony/SubscriptionInfo#getIccId()">getIccId()</a> method, which now returns an empty string.</p><p>Apps that may previously be utilizing this identifier to link functionality to a certain SIM should verify compatibility with the “empty string” return value on Android 11. One alternative is to use the <a href="https://developer.android.com/reference/android/telephony/SubscriptionInfo#getSubscriptionId()">getSubscriptionId()</a> method, which returns a 1-based unique index value for a given SIM on the device. That is, if the same SIM is reinstalled on a device, it will retain the previously assigned subscription identifier unless the device is factory-reset. <a href="https://developer.android.com/training/articles/user-data-ids#mobile-service-subscriptions">Learn more</a>.</p><p>The platform and Google Play services offer a number of <a href="https://developer.android.com/training/articles/user-data-ids#identifier-characteristics">identifiers</a> with various uniqueness, resettability, and scope that are suitable for various use cases. You can check out more identifier <a href="https://developer.android.com/training/articles/user-data-ids">use cases</a>.</p><p>I hope you find these recommendations useful in helping you prepare for target API level update and making your app’s design more privacy-friendly! You can learn more about other <a href="https://developer.android.com/about/versions/11/privacy">related improvements in Android 11</a> and <a href="https://developer.android.com/privacy/best-practices">privacy best practices</a> in the documentation.</p><p><em>Thanks to Kevin Hufnagle and Jeremy Walker.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7469a547314" width="1" height="1" alt=""><hr><p><a href="https://medium.com/androiddevelopers/adapt-your-app-for-the-latest-privacy-best-practices-d7469a547314">Adapt your app for the latest privacy best practices</a> was originally published in <a href="https://medium.com/androiddevelopers">Android Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>