/** * A notification function for telling Java to perform installation of * a MIDlet from filesystem, * * The installation will be performed in the background without launching * the graphic installer application. * * The given path is the full path to MIDlet's jad file or jad. * In case the MIDlet's jad file is specified, then * the MIDlet's jar file muts reside in the same directory as the jad * file. * * @param jadFilePath full path the jad (or jar) file which is of the form: * file://a/b/c/d.jad * @param jadFilePathLen length of the file path * @param userWasAsked a flag indicating whether the platform already asked * the user for permission to download and install the application * so there's no need to ask again and we can immediately install. */ void javanotify_install_midlet_from_filesystem(const javacall_utf16* jadFilePath, int jadFilePathLen, int userWasAsked) { int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; REPORT_INFO(LC_CORE, "javanotify_install_midlet_from_filesystem() >>\n"); JVM_Initialize(); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = "com.sun.midp.scriptutil.CommandLineInstaller"; argv[argc++] = "I"; if (jadFilePathLen >= BINARY_BUFFER_MAX_LEN){ REPORT_ERROR(LC_AMS, "javanotify_install_midlet_from_filesystem(): jadFilePathLen is too long"); return; } memset(urlAddress, 0, BINARY_BUFFER_MAX_LEN); unicodeToNative(jadFilePath, jadFilePathLen, (unsigned char *)urlAddress, BINARY_BUFFER_MAX_LEN); argv[argc++] = urlAddress; javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * A notification function for telling Java to perform installation of * a MIDlet from filesystem, * * The installation will be performed in the background without launching * the graphic installer application. * * The given path is the full path to MIDlet's jad file or jad. * In case the MIDlet's jad file is specified, then * the MIDlet's jar file muts reside in the same directory as the jad * file. * * @param jadFilePath full path the jad (or jar) file which is of the form: * file://a/b/c/d.jad * @param jadFilePathLen length of the file path * @param userWasAsked a flag indicating whether the platform already asked * the user for permission to download and install the application * so there's no need to ask again and we can immediately install. */ void javanotify_install_midlet_from_filesystem(const javacall_utf16 * jadFilePath, int jadFilePathLen, int userWasAsked) { midp_jc_event_union e; midp_jc_event_start_arbitrary_arg *data = &e.data.startMidletArbitraryArgEvent; REPORT_INFO(LC_CORE,"javanotify_install_midlet_from_filesystem() >>\n"); e.eventType = MIDP_JC_EVENT_START_ARBITRARY_ARG; data->argc = 0; data->argv[data->argc++] = "runMidlet"; data->argv[data->argc++] = "-1"; data->argv[data->argc++] = "com.sun.midp.scriptutil.CommandLineInstaller"; data->argv[data->argc++] = "I"; if (jadFilePathLen >= BINARY_BUFFER_MAX_LEN) return; memset(urlAddress, 0, BINARY_BUFFER_MAX_LEN); unicodeToNative(jadFilePath, jadFilePathLen, (unsigned char *) urlAddress, BINARY_BUFFER_MAX_LEN); data->argv[data->argc++] = urlAddress; midp_jc_event_send(&e); }