Are there any methods that a Sim Toolkit applet is selected when phone boots or SIM card is inserted on phone?
I want an applet on a SIM card that automatically executes some commands and display a message when SIM is installed on phone or phone boots.
STK Applet got 3 methods 'process','processToolkit'and 'install'. I don't know if each of methods 'process','processToolkit' can be called during phone boot or SIM installation on phone?
This is possible. You have to register the event EVENT_PROFILE_DOWNLOAD
during the applet installation.
toolkitRegistry = ToolkitRegistrySystem.getEntry();
toolkitRegistry.setEvent(EVENT_PROFILE_DOWNLOAD);
// in case you need a menu later, too:
toolkitRegistry.initMenuEntry( ...
When the SIM is started the modem will always execute the TERMINAL PROFILE commmand. This will trigger the registered EVENT_PROFILE_DOWNLOAD
by processToolkit
. In case you have a menu the menu selection will be handled also by processToolkit
. The event will be EVENT_MENU_SELECTION
then.
From processToolkit
you can execute any necessary behavior, e.g. displaying a text.
ProactiveHandlerSystem.getTheHandler().clear();
ProactiveHandlerSystem.getTheHandler().initDisplayText((byte) 0x81, 0x04, array, offset, (short) (length));
byte res = ProactiveHandlerSystem.getTheHandler().send();
return res == RES_CMD_PERF;
The array would be the ASCII encoding of your text.
Consult the UICC API as startign point.