Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
SaMMoX
Posts: 87
Registered: ‎07-07-2010
My Device: 8520

Porting API 5.0 to API 6.0/7.0

Hi,

I have an application that works correctly with API 5.0, but does not start if I compile and run it with API 7.0. If I try to click on the application icon I can read in the console of Eclipse this message:

 

Foreground app MY_APP_PACKAGE ignoring touchsc[0.0] reen touch/click because it has no target screen.

 

Can you tell me the meaning of this message? I think this is the problem... This is the main of the app (I've an alternate entry point with application argument "init", home screen position "0", auto-run on startup checked and startup tier "7").

 

public class MyApp extends UiApplication {
	public static void main(String[] args) {

		if (args != null && args.length > 0 && "init".equals((String) args[0])) {
			Timer timer = new Timer();
			timer.schedule(new MyTimerTask(), Constants.TimerThread.DELAY_START, Constants.TimerThread.INTERVAL);

		} else {
			MyApp theApp = new MyApp (false);
			theApp.enterEventDispatcher();
		}
		if (ApplicationManager.getApplicationManager().inStartup()) {
			MyApp theApp = new MyApp (true);
			theApp.addFileSystemListener(new MyAppFileSystemListener(theApp));
			theApp.enterEventDispatcher();
		}
	}

	
	public MyApp (boolean startup) {
		if (ApplicationManager.getApplicationManager().inStartup()) {
			
			registerListener();

			PersistentObject persistentObject = PersistentStore.getPersistentObject(Constants.Persistent.VENDITORE_ID);
			persistentObject.setContents((Venditore) null);
			persistentObject.commit();
			
			PersistentObject persistentLog = PersistentStore.getPersistentObject(Constants.Persistent.LOG_ID);
			persistentLog.setContents((Boolean) Boolean.TRUE);
			persistentLog.commit();
			
			PersistentObject persistentLockPim = PersistentStore.getPersistentObject(Constants.Persistent.LOCK_PIM_ID);
			persistentLockPim.setContents((Boolean) Boolean.TRUE);
			persistentLockPim.commit();
			
			PersistentObject persistentShowOptions = PersistentStore.getPersistentObject(Constants.Persistent.SHOW_OPTIONS_ID);
			persistentShowOptions.setContents((Boolean) Boolean.FALSE);
			persistentShowOptions.commit();
			
			PersistentObject persistentSync = PersistentStore.getPersistentObject(Constants.Persistent.SYNC_ID);
			persistentSync.setContents((Boolean) Boolean.TRUE);
			persistentSync.commit();
			
			PersistentObject persistentTodo = PersistentStore.getPersistentObject(Constants.Persistent.TODO_ID);
			persistentTodo.setContents((String) null);
			persistentTodo.commit();
			
			EventLogger.register(Constants.Persistent.EVENT_LOGGER_ID, Constants.Application.TITLE_APP, EventLogger.VIEWER_STRING);
		} else {
			if (!startup) {
				if (!Util.isSDCardMounted()) {
					Util.logDebug("SDCard non montata");
					pushScreen(new Dialog(Dialog.D_OK, Constants.System.NO_SDCARD_DETECTED,
							0, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), Dialog.FIELD_HCENTER));
				} else {
					// Il push dello screen si fa solo se non siamo nella fase di startup
					pushScreen(new MyAppMainScreen());
				}
			}
		}
	}
	
	
	
		
	
	public void registerListener() {
		PIM p = PIM.getInstance();
        try {
        	BlackBerryEventList eventList = (BlackBerryEventList) p.openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE);
            eventList.addListener(new SFAPimListener());
        } catch (PIMException e) {
            // Can't add listener
        	Util.logError("Errore durante la registrazione del listener " +
        			"relativo alla modifica di eventi sull'agenda" +
        			"nativa del BlackBerry", e);
        }
        
        MyMenu menu = new MyMenu ();
		ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_CALENDAR, menu);
		

	}

	/* public void batteryGood() {
		// TODO Auto-generated method stub
		
	}

	public void batteryLow() {
		// TODO Auto-generated method stub
		
	}

	public void batteryStatusChange(int status) {
		// TODO Auto-generated method stub
		
	}

	public void powerOff() {
		// TODO Auto-generated method stub
		
	}

	public void powerUp() {
		// TODO Auto-generated method stub
		
	} */
}

 Thanks in advance.

 

Regards,

Gianni.

Developer
simon_hain
Posts: 16,347
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Porting API 5.0 to API 6.0/7.0

there should be no difference.
the error message could mean that you did not push a screen, i would suggest to check the proceedings with the debugger.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
peter_strange
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Porting API 5.0 to API 6.0/7.0

[ Edited ]

I agree with Simons comments, my experience is that OS 5.0 apps will run in OS 7.0, and debugging should sort out where your problem. 

 

That said, there are cases where things that were let go in OS 5.0 were stopped in OS 6.0 and later.  In this case I suspect your start up processing falls into that category.  I would review what you have in there, and compare it with the following KB article.  I think you can re-write it to simplify it and I think it may overcome some of your start-up issues. 

 

http://supportforums.blackberry.com/t5/Java-Development/Write-safe-initialization-code/ta-p/444795

 

Edit: link corrected....

Regular Contributor
SaMMoX
Posts: 87
Registered: ‎07-07-2010
My Device: 8520

Re: Porting API 5.0 to API 6.0/7.0

Thank you very much. Can you give the link to the KB? I try to search that article but I didn't find it...

Developer
peter_strange
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Porting API 5.0 to API 6.0/7.0

Aoppss sorry, link corrected....