检测 MIDlet 是否是首次安装或运行
我正在使用 J2ME SDK 3.0 和 J2ME Polish,我想知道当用户安装应用程序或 MIDlet 首次运行时是否调用任何事件。
I'm using J2ME SDK 3.0 and J2ME Polish and i would like to know if there's any event that is called when the user installs the application or when the MIDlet is running for the first time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有特定的“首次运行”事件。但是,当MIDlet启动时,系统将调用
MIDlet.startApp()
。您可以通过创建 RecordStore 并在其中保存一些信息来实现自己的“首次运行”检测。如果 RecordStore 不存在,则首先运行它。如果是这样,那么您之前已经运行过 MIDlet。There is no specific "first run" event. However, when the MIDlet starts, the system will invoke
MIDlet.startApp()
. You can implement your own "first run" detection by creating a RecordStore and saving some information in it. If the RecordStore does not exist, then it's first run. If it does, then you have run the MIDlet before.