Sony Ericsson JP-7 平台(部份早期機型如 K790 不支援)提供開機自動啟動 MIDlet 的能力,透過 PushRegistry 機制實現。
在 JAD 檔案中加入:
MIDlet-Push-1: autostart://:, AutoStartStatic, *
autostart://:(注意雙冒號)。* 表示接受所有發送者。public void registerAutoStart() {
String[] connections = PushRegistry.listConnections(false);
if (connections.length == 0) {
try {
PushRegistry.registerConnection("autostart://:", "AutoStartDyn", "*");
// 註冊成功提示
} catch (Exception ex) {
// 處理例外
}
}
}
public void unregisterAutoStart() {
if (PushRegistry.unregisterConnection("autostart://:")) {
// 解除成功
} else {
// 原未註冊或失敗
}
}
autostart 協議。JP-7 平台的 autostart://: 協議為 MIDlet 開機自啟提供標準化路徑,開發者可根據業務需求選擇靜態或動態註冊方式。