Since version 26.0.0, the signal line function is supported.
A signal line is a colored polyline that dynamically reflects the signal strength on the map. A signal line can predict weak-signal or no-signal road sections on a route and remind users to download an offline map in advance, improving outdoor safety.

This permission is available only to verified enterprise developers.
Device restrictions: The signal line function is applicable only to phones, tablets, PCs/2-in-1 devices, and wearables.
Scenario Constraints
The request scenario must be clearly related to map display, route planning, and outdoor travel decision-making. When requesting this permission, you should integrate and use this capability based on the Map Kit capabilities. Common request scenarios are as follows:
The request scenario must be clearly related to network quality information, such as self-driving route recommendation, hike route planning, and outdoor rescue assurance.
The following scenarios are not supported:
The signal line function is mainly provided by MapSignalParams, addSignalLine, and MapSignalLine. For more information about the APIs, please refer to API Reference.
| API | Description |
|---|---|
| MapSignalParams | Signal line attributes. |
| addSignalLine(params: mapCommon.MapSignalParams): Promise<MapSignalLine> | Adds a signal line. |
| MapSignalLine | Signal line management object. |
To use the signal line function, you need to enable the signal prediction capability first.
Currently, the permission request entry is available only to enterprise developers.
Sign in to AppGallery Connect and click Development and services.

Find the app for which you want to enable the signal prediction capability.

Go to the Manage open capabilities tab page, find Signal Prediction Capability under Map Kit, and click Request.

Click Next after confirming that you meet all the conditions for enabling the signal prediction capability.

Enter the request reason.
Template for filling in the request reason:

After the system sends a message to the interaction center, wait for the review. The review result will be sent to the interaction center through an internal message within three working days.
After the request is approved, select Map Kit and Signal Prediction Capability to complete the configuration.

Import required modules.
import { MapComponent, mapCommon, map } from '@kit.MapKit';
import { AsyncCallback } from '@kit.BasicServicesKit'; Draw a signal line.
@Entry
@Component
struct MapSignalLineDemo {
// ...
private mapOptions?: mapCommon.MapOptions;
private mapController?: map.MapComponentController;
private callback?: AsyncCallback<map.MapComponentController>;
private mapSignalLine?: map.MapSignalLine;
aboutToAppear(): void {
this.mapOptions = {
position: {
target: {
latitude: 32.055583099352,
longitude: 118.540076398149
},
zoom: 14
}
};
this.callback = async (err, mapController) => {
if (!err) {
this.mapController = mapController;
let mapSignalParams: mapCommon.MapSignalParams = {
signalId: 'signalId1'
};
mapSignalParams.points =
[{ longitude: 118.553695, latitude: 32.050789 }, { longitude: 118.553738, latitude: 32.050884 },
{ longitude: 118.548506, latitude: 32.048543 }, { longitude: 118.548413, latitude: 32.048374 },
{ longitude: 118.547185, latitude: 32.048252 }, { longitude: 118.546939, latitude: 32.048296 },
{ longitude: 118.544343, latitude: 32.048765 }, { longitude: 118.544098, latitude: 32.048780 },
{ longitude: 118.538145, latitude: 32.048836 }, { longitude: 118.537896, latitude: 32.048846 },
{ longitude: 118.537654, latitude: 32.048818 }, { longitude: 118.537446, latitude: 32.048708 },
{ longitude: 118.532201, latitude: 32.049620 }, { longitude: 118.532076, latitude: 32.049583 },
{ longitude: 118.531726, latitude: 32.049490 }, { longitude: 118.531593, latitude: 32.049475 },
{ longitude: 118.531466, latitude: 32.049443 }, { longitude: 118.528349, latitude: 32.052531 },
{ longitude: 118.528298, latitude: 32.053657 }, { longitude: 118.528288, latitude: 32.053851 },
{ longitude: 118.527082, latitude: 32.054653 }, { longitude: 118.526755, latitude: 32.054781 },
{ longitude: 118.526755, latitude: 32.054857 }, { longitude: 118.526654, latitude: 32.055124 },
{ longitude: 118.529706, latitude: 32.057719 }, { longitude: 118.530101, latitude: 32.057906 },
{ longitude: 118.530211, latitude: 32.057911 }, { longitude: 118.532985, latitude: 32.058305 },
{ longitude: 118.538524, latitude: 32.057508 }, { longitude: 118.538571, latitude: 32.057418 },
{ longitude: 118.540255, latitude: 32.058049 }, { longitude: 118.540545, latitude: 32.058251 },
{ longitude: 118.540655, latitude: 32.058285 }, { longitude: 118.543645, latitude: 32.059025 },
{ longitude: 118.543763, latitude: 32.059010 }, { longitude: 118.545292, latitude: 32.059901 },
{ longitude: 118.545397, latitude: 32.059912 }, { longitude: 118.548790, latitude: 32.063339 },
{ longitude: 118.549064, latitude: 32.063531 }, { longitude: 118.550198, latitude: 32.064369 },
{ longitude: 118.552740, latitude: 32.059904 }, { longitude: 118.552866, latitude: 32.059620 },
{ longitude: 118.552929, latitude: 32.059516 }, { longitude: 118.553045, latitude: 32.059157 },
{ longitude: 118.553078, latitude: 32.059049 }, { longitude: 118.553186, latitude: 32.056241 },
{ longitude: 118.553204, latitude: 32.056126 }, { longitude: 118.553062, latitude: 32.053036 },
{ longitude: 118.553555, latitude: 32.051478 }, { longitude: 118.553626, latitude: 32.051203 },
{ longitude: 118.553650, latitude: 32.050680 }, { longitude: 118.553684, latitude: 32.050578 }];
// Add a signal line.
try {
this.mapSignalLine = await this.mapController.addSignalLine(mapSignalParams);
} catch (e) {
console.error(`Failed to create the signalLine. Code: ${e.code}; message: ${e.message}`);
}
} else {
// Map initialization failed.
console.error(`Failed to initialize the map. Code: ${err.code}; message: ${err.message}`);
}
};
}
build() {
// ...
Stack() {
Column() {
MapComponent({ mapOptions: this.mapOptions, mapCallback: this.callback });
}.width('100%')
}.height('100%')
// ...
}
} Use removeSignalLineCache to remove cached signal line data from the map to free up storage space.
// Delete the cached data of the signal line with ID signalId1.
let mapSignalParams: mapCommon.MapSignalParams = {
signalId: 'signalId1'
};
mapSignalParams.points =
[{ longitude: 118.553695, latitude: 32.050789 }, { longitude: 118.553738, latitude: 32.050884 },
{ longitude: 118.548506, latitude: 32.048543 }, { longitude: 118.548413, latitude: 32.048374 },
{ longitude: 118.547185, latitude: 32.048252 }, { longitude: 118.546939, latitude: 32.048296 }];
// When a signal line is added for the first time, the line information is automatically cached.
try {
let mapSignalLine1 = await this.mapController.addSignalLine(mapSignalParams);
// After the deletion, the cache is triggered when a signal line is added with the same signal ID (no value is passed for points).
mapSignalLine1.remove();
let mapSignalLine2 = await this.mapController.addSignalLine({signalId: mapSignalParams.signalId});
// After the line is deleted again, call removeSignalLineCache to remove the cached signal line data.
mapSignalLine2.remove();
this.mapController?.removeSignalLineCache(mapSignalParams.signalId);
} catch (e) {
console.error(`Operation failed. Code: ${e.code}; message: ${e.message}`);
}