arsalandywriter.com

Migrate Your Apps from Android 12L to Android 13 in 5 Steps

Written on

Chapter 1: Overview of Migration

This guide is designed for Android developers aiming to understand the essential procedures to transition from Android 12L (API Level 32) to Android 13 (API Level 33). For a comprehensive list of changes, please refer to the official documentation.

The following concepts are crucial in this migration:

  • Changes in notification permissions
  • Battery resource management
  • Permissions regarding advertising ID
  • Restrictions on non-SDK interfaces

Section 1.1: Prerequisites for Migration

Before starting the migration, ensure you have the following:

  • Android SDK
  • Notification Runtime Permission
  • Foreground Services

Section 1.2: Notification Permission Changes

When a user denies notification permission for your app, notifications related to foreground services will not be displayed in the notification drawer. However, these notifications will still show up in the Foreground Services Task Manager (FGS), regardless of the permission status. For further details, you can read about notification runtime permissions.

To declare this permission, include the following in your manifest:

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

Note:

  • For new devices, notifications will be disabled by default, and users need to grant permission.
  • Existing apps won't require users to grant runtime permissions.

Section 1.3: Battery Resource Utilization

Users can select from several options regarding battery usage:

  • Unrestricted: Permits all background tasks, which may lead to higher battery consumption.
  • Optimized (default): Balances background activity based on user interaction with the app.
  • Restricted: Completely blocks the app from running in the background, potentially affecting its functionality.

If your app is categorized as "restricted" for battery use under Android 13 (API Level 33), the system will not send the BOOT_COMPLETED or LOCKED_BOOT_COMPLETED broadcasts until the app is initiated for other reasons.

Section 1.4: Advertising ID Permissions

The Advertising ID is a unique identifier that users can reset or delete, provided by Google Play services. It's crucial to declare the AD_ID permission in your app's manifest:

<uses-permission android:name="android.permission.ACCESS_AD_ID" />

If this permission is not declared, the advertising ID will be replaced with a string of zeros. If you're using SDKs that already declare this permission, it will automatically merge into your app’s manifest.

Section 1.5: Avoiding Non-SDK Interfaces

Non-SDK interfaces are restricted in Android 13. Ensure your application does not utilize these interfaces. Test your app for any occurrences of non-SDK interfaces using the following guidelines:

  • Instead of using setDisablePreviewScreenshots(), utilize setRecentsScreenshotEnabled().
  • Replace isLightDeviceIdleMode() with isDeviceLightIdleMode().
  • Avoid changing the process name using setArgV0(), and if necessary, consider using pthread_setname_np().
  • Substitute clearCache() with android.accessibilityservice.AccessibilityService#clearCache().

Section 1.6: Update Your Target SDK

Lastly, ensure that both your targetSdk and compileSdk are updated to 33, as this is essential for compliance with the latest Android specifications.

The second video discusses the implications of having an API level of 30 while the minimum target API level must be 33.

Share the page:

Twitter Facebook Reddit LinkIn

-----------------------

Recent Post:

The 6 Wealthiest Individuals in History and Their Achievements

Explore the six wealthiest individuals of all time and their monumental contributions to society and industry.

# Harnessing Emotional Design for Powerful UX Experiences

Explore how emotions shape UX design and discover ten key emotions that enhance creativity and user engagement.

How to Cultivate Your Own Motivation from the Ground Up

Discover how to generate your own motivation by identifying personal goals and tracking accomplishments.