Mobile Development 15 min read

Foldable Screen Adaptation for JD Mini‑Program on Android

This article examines the growing trend of foldable Android screens, outlines the challenges JD mini‑programs face when adapting to such devices, and presents practical solutions including resizable activities, aspect‑ratio handling, configuration‑change management, rpx units, and engine‑level fixes to ensure seamless user experience across inner and outer screens.

JD Tech
JD Tech
JD Tech
Foldable Screen Adaptation for JD Mini‑Program on Android

With the rapid development of smartphones, foldable screens have become a key trend for Android devices, and JD's mini‑program team has increasingly supported more business scenarios on these devices. Adapting mini‑programs to foldable screens not only follows market direction but also improves user experience.

Android Application Screen Adaptation Overview – Android 10 (API level 29) and above support a wider range of aspect ratios. By default, android:resizableActivity is true, indicating full multi‑window support. Developers can set it to false to enter compatibility mode, and must handle configuration changes such as orientation, screen size, and multi‑window transitions to preserve activity state.

Mini‑Program Foldable Screen Status – Mini‑programs rely on a WebView rendering engine; when the screen size changes, layout inconsistencies arise because the engine does not automatically receive updated dimensions. Existing mini‑programs lack official foldable‑screen adaptation guidelines.

Key Issues

Element size mismatch after folding: the container size changes while element dimensions remain static, causing layout compression.

Inability to restart: the mini‑program process may be killed after folding, preventing it from being relaunched from the task stack.

Multi‑window and picture‑in‑picture interactions that can trigger unwanted restarts.

Inconsistent screen size data from the JavaScript window object, leading to inaccurate rpx calculations.

Solution Approaches

Listen for screen folding by recording current parameters (width, height, orientation) and handling onConfigurationChanged callbacks to detect changes.

Refresh strategies: (a) partial refresh where the business layer updates the UI, or (b) full restart of the mini‑program to guarantee correct layout.

Use android:configChanges to manually manage orientation, screenSize, and keyboardHidden changes, avoiding unnecessary activity restarts.

Replace engine usage of window dimensions with actual screen metrics to keep rpx calculations accurate.

Implementation Details – The team added logic to detect configuration changes, filtered out false positives from navigation bars, and chose a full‑restart approach within the same process to avoid task‑stack issues. Aspect‑ratio testing guidelines were provided, and the rpx unit was emphasized for responsive design.

Results – After applying these measures, the mini‑program displayed stable behavior during inner‑screen to outer‑screen transitions, background wake‑ups, and multi‑window usage, delivering a satisfactory user experience.

Additional Information – JD Mini‑Program Open Platform offers ISVs free entry, 1‑to‑1 support, and promotional resources. For more details, visit the official documentation or contact JD via email, WeChat, or phone.

mobile developmentAndroidmini-programconfiguration changesfoldable screenrpx
JD Tech
Written by

JD Tech

Official JD technology sharing platform. All the cutting‑edge JD tech, innovative insights, and open‑source solutions you’re looking for, all in one place.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.