03-31-2011 04:39 AM
I am making an application that accesses to the native camera application and takes a picture from it. When the picture is saved, i want the cam application to be closed and return the result to me. I managed to do this as follows:
1- Invoke the cam application
3- In this FileSystemJournalListener, I enter the corresponding code to perform.
On the simulator, everything look fine. The Camera application is invoked and when a picture is taken, it will be closed and the pic will be added to the application. When I installed the application on Blackberry cellphones, I had a problem!!!
The app worked on one device out of 6!! The other devices invoke the camera, but when a picture is taken, nothing happens. Why will that work on one device and not on all devices, while all devices have the same operating system and the same camera settings??? I did a lot of researches but didn't find anything helpful.
Can anyone please help?
03-31-2011 05:08 AM - edited 03-31-2011 05:10 AM
I had a similar issue before.
It had to do with the type of event that came back in the FileSystemJournal listener. What often happens is that multiple operations are performed on the same file. So if you are only checking if the last operation was a file add.
entry.getEvent() == FileSystemJournalEntry.FILE_ADDED
You may not trap the event... because there may have been a save on the file after it was added.
You also need to check for:
And this may involve a further bit of funky code where you need to go back in the history of file journal events to match up file identifiers.
03-31-2011 05:57 AM
My code is the following:
So i dont guess that your solution will solve the problem! cause I already used it in my code.
What can the solution of this problem be?
03-31-2011 06:36 AM
Do all the devices have SD cards... I have found that sometimes FileSystemJournalListener doesn't work so well when the images aren't being saved to SD.
03-31-2011 07:15 AM
Yeah i searched about this topic too. And yes all off the devices have an SDCard. The confusing is that all the devices are the same!! So why it is working only on one device!! I checked too the location where the images are saved and it is the same location
03-31-2011 07:37 AM
If you are able to debug, check if it's actually getting to that for loop where you go back in history... (otherwise write out some log files to see if it gets there).. At least then you might start getting idea on where it is failing. You can try instead of exiting on null, executing the code after only if the entry != null .... who knows maybe there are null entries that pop up for some bizarre reason, and that stops the whole loop.
I remember that i didn't store the the last journal number that I read... but instead would only look back 10 entries in the journal entries to try and find one where a file was added.
03-31-2011 07:40 AM
The other thing you can also start looking into is to ensure that the listener is really present when the call to taking the picture is made... maybe for some reason something could be going wrong, causing that listener to be invalidated. A re-creation of the screen or something equally bizarre.
03-31-2011 09:09 AM
Hey Peter, the problem is that the listener isn't invoked because there are several functions to perform before closing the camera and none of them is applied.
03-31-2011 09:42 AM
Peter I checked the Alt + lglg on the device. I concluded that the FileSystemJournalListener is running on all devices. But the problem is that on the 6 devices, it is throwing an exception. The exception is: "