读书人

OpenBaseMovil 晋级机制

发布时间: 2012-09-23 10:28:11 作者: rapoo

OpenBaseMovil 升级机制

   protected void startApp()            throws MIDletStateChangeException    {        try        {            // If the last time the application exited it set the install.url            // setting, it means that we should install a new version of the            // midlet and exit again            final String installURL = Settings.getProperty( "install.url" );            if( installURL != null )            {                Settings.setProperty( "install.url", null );                platformRequest( installURL );                destroyApp( true );                notifyDestroyed();            }            else            {                ((MainController) ViewFactory.getController( "main" ))                        .startApplication();            }        }        catch( Exception e )        {            log.error( e );            throw new MIDletStateChangeException( e.getMessage() );        }    }

从代码可以看出其机制:正常情况下,升级URL是空的,当用户希望升级时,将在RMS中设置升级URL,在应用下次启动时,检测到升级URL不为空就进入了升级流程:
1. 首先清空升级URL值(用户升级后可能保留其RMS数据)
2. 发出平台下载请求(升级URL)
3. 退出应用(应用运行时是不可能升级的)

我的想法:在对于每个应用,在服务器中设置一个文件,里面有应用最新的版本号,当用户发出升级命令时,检查服务器文件的版本号,若比现时的应用高,则进入2,3流程
1 楼 wuhua 2008-03-25 相对来说,这样比较简单的。j2me升级直接下载个升级包就ok了。

读书人网 >移动开发

热点推荐