Application cannot be deleted when has multiple en

2019-05-31 23:08发布

问题:

EDIT: Using simpler code. I have a blackberry app that until recently (I upgraded to 6.0.0.600 on my torch) could be deleted. Now I can't even if I use javaloader -u erase (module in use) and the UI context menu or physical menu has no option for delete. The code below just requires an app descriptor with an alternate entry point on startup with parameters "startVibrate". The entry points code is below.

   package mypackage;

import net.rim.device.api.system.Alert;
import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.UiApplication;

/**
 * This class extends the UiApplication class, providing a
 * graphical user interface.
 */

public class ScheduleAppDemo extends UiApplication
{
    public static void main(String[] args)
    {
        if (args != null && args.length > 0 && "startVibrate".equals(args[0]))
        {
            scheduleVibrate();
        }
        else
        {
            ScheduleAppDemo app = new ScheduleAppDemo();
            app.enterEventDispatcher();
        }
    }
    public ScheduleAppDemo()
    {
        ScheduleAppDemoScreen screen = new ScheduleAppDemoScreen();
        pushScreen(screen);
    }

    public class ScheduleAppDemoScreen extends MainScreen
    {
        public ScheduleAppDemoScreen()
        {
            setTitle("Schedule app demo");
        }
    }   

    private static void scheduleVibrate()
    {
        Alert.startVibrate(2550);
        ApplicationDescriptor current = ApplicationDescriptor.
        currentApplicationDescriptor();
        current.setPowerOnBehavior(ApplicationDescriptor.DO_NOT_POWER_ON);
        ApplicationManager manager = ApplicationManager.getApplicationManager();
        manager.scheduleApplication(current, System.currentTimeMillis() 
                + 60000, true);
    }
}

Basically what this shows you is that it vibrates every minute. Unfortunately evidence says it appears the Application Manager keeps the background process running during the time and then just calls it again when it's time to run occurs again. This is the sample app from RIM. Deleting all Alternate Entry Points in the Application descriptor.xml allows the app to be deleted. Other than modifying that, reloading the cods, and then deleting it; how can I delete the app.

回答1:

The behavior is 'correct', in as far as this is exactly how an application with an alternate entry point would behave in the field.

When an application has an alternate entry point, deleting it only marks it for deletion. The actual deletion occurs when the device is restarted and the .cods are reloaded.

This is why, when a user tries to delete an application that has an alternate entry point with a running process in the background, a dialog box always pops up letting the user know that the application will be removed on restart, and asking whether they would like to reboot now.

Until the device is rebooted, the background process will continue to run.