I am developing a Java ME application which uses the camera to take a snapshot and then decodes it (using ZXing library). The target is Nokia phones.
I need to use the focus to have a clear image, if not, it is difficult to decode the image.
Since the Series 40, the control "videocontrol" and "SnapShopControl" are available. I thought that for the "FocusControl" it was the same, but it isn't.
I discovered that it is almost non-existent, not only for the Series 40 (only some phones), but (more surprisingly) for the Series 60 and Symbian 3.
You can see that in Java ME API support on Nokia devices.
These mobile phones support JSR-234 but for audio and music, not for camera.
As you can imagine, this is very deceiving, Nokia is not doing their work well.
Did you find any solution? Perhaps another "made-by-hand" control? I am afraid I have to start programming in C++ because I haven't got much time.
The solution has been to use Nokia's APIBridge (an extensible mechanism to access device features in WRT, Flash Lite, and Java applications). You can access the software is installed in the phone for the camera and if it is able to use the autofocus, you can use it, and it returns the image you take.
See Tool details for APIBridge for further details.
The implementation is easy (you install the SIS file for the APIBridge in the device, and you can package your application and this SIS file together).
You use the following code:
APIBridge bridge = APIBridge.getInstance();
bridge.Initialize(midlet);
NewFileService service = (NewFileService) bridge.createService("service.newfileservice");
Hashtable filter = new Hashtable();
filter.put("NewFileType", "Image");
BridgeResult res= service.TakePhoto(filter);
Many phones' hardware just don't support focus. Some Sony Ericsson phones (e.g. G502) support FocusControl, but they don't allow to do anything because the hardware does not support it.
I'm afraid to say that you can do probably nothing with this problem in Java ME.
If the phones support focus control, but it is not availble in Java ME, there are probably two ways how to solve it:
Let user to use the builtin camera and load it (preferably the last photo) from Camera album.
Try to use camera focus from a S60 API.
Note that I'm not a S60 developer.
Related
I am creating an application for tablet in android where, I want to use usb camera as a default camera when I start my application. I want to click picture and save them in either jpeg,jpg or png format. I could not find any helpful resources on web. How can I implement such functionality? Any help would be appreciated.
The solutions are all complex with advantages and disadvantages. Information on USB and UVC is freely available from the USB IF web site, although there are many hundreds of pages of detail. The main issue is that the isochronous transfer method is missing from the Android framework, although descriptor retrieval, control, interrupt and bulk are implemented. Hence, most of the usb access can be done in Java or Kotlin, but the streaming side is a real pain. Using method one below and a Logitek C615 webcam, I obtained 640x480#30 fps on a Lenovo Tab10 using Android 6, and 1920x1080#30fps on a Lenovo IdeaPad 520 Miix using Android9 x86. The Tab10 appears to run at USB v1 speeds although it has a USB v2 micro-B socket. The Miix has a type A USB socket and does not need an OTG converter. I know of three methods:
Use Libusb. This requires a separate compilation and build in Android Studio to a shared library. Write C++ code to setup, transfer packets and teardown the webcam. Write Java code for the user interface, decompress MJPEG, display preview and write JPEGs to storage. Connect the two via JNI. The C++ and Java run in separate threads but are non blocking. The inefficiency is in memcopying from a native image frame array to a JNI array and then freeing for garbage collection after each frame. Android apps run in a container, which means a special startup for Libusb and some functions fail, probably because of selinux violations.
Use JNA to wrap the Libc libray. JNA is obtained from a repository and does not require a separate build. Libc is in Android Studio. All the code is Java, but IOCTL is used to control the usb file streams and the small stuff is really sweated. Libusb does much of the low level stuff in design choice 1.
Use the external camera option with the Camera2 API. Non of my devices support an external camera, not even my Samsung Android 13 phone. I suspect this is meant for systems integrators to build custom versions of Android with the appropriate settings as documented by Google, implemented on SBCs for point-of-sale etc.
I have been trying to look into this and it seems hard to find good solid info. Is there anyone out there that has created any java packages that interact with NFC phones, cards, etc. I haven't been able to find a lot on how NFC works really. I just want to be able to read the id of the phone, or its phone number, when it scans. Any way to do this?
I was reading this:
http://java.sun.com/developer/technicalArticles/javame/nfc/
which mentions the package javax.microedition.contactless
but can't seem to figure out how to implement it. I am not great at Java, only in my second semester. This over my head?
The Android has own Java API, which differs from JavaMe. This applies not only to NFC, but also to other areas. The above mentioned API you can use on JavaMe NFC enabled phones like Nokia 6212, some Samsungs and Sagem.
If you plan to use NFC I suggest you to either use the Android - there are 2 widely available NFC phones on the market or Symbian, where is dozens of models already released. The other option is go with RIM BlackBerry.
BR
STeN
I heard that we can use Adobe Flash Builder to develop apps for android. But I have a doubt, can we create any type of application? are there any limitations to adobe flash applications?
I know flash is good for games and internet applications.
I am confused, which is better for android app creation? Java or Flash?
Advantages of using Flash:
One code base, many (iOS, Android, Blackberry) platforms
Easy navigation between view (as iOS does not have a hardware back button)
Good for apps which serve as a front end for RESTful web services
Supports gestures, camera, vibration, contacts
Disadvantages of using Flash
Performance takes a hit when you try to do image processing and other heavy stuff
Cannot access front camera
Doesn't give you as much control as Java
Advantages of using Java
Can exploit Android OS to its fullest
Performance is better in case of complex apps
Disadvantages of using Java
Cannot use the code-base to target other platforms
IMHO, it depends on the use-case of your app.
Major disadvantage: Adobe has announced that they will stop
developing/supporting Flash on Android
It'll be a long time before desktop will follow, considering that most users are IE users (Google analytics supported) and remember that IE9 still has VERY limited support for HTML5 where as Flash has 99% global cover on PCs.
So until such time as all browsers have much more HTML5 support, Flash will still be here for a while - whether it's here for good, perhaps not - but Adobe are already creating their new Flash Development tool to output HTML5 as well as SWF files. But like all file types, they will eventually have their day - but it's not yet that time.
java with android sdk is 100% and Flash with adobe air is 70%(approx).becase adobe provide same functionality like android sdk useing "Native code" but some functionality that cant allow by flash.
another thin is that version problem.you can continue with 2.2 or higher.
some Broadcasting functionality are not there
Advantage::
flash game building are easy and just 2 to 3 step to convert it into apk or iphone formate.
Major disadvantage: Adobe has announced that they will stop developing/supporting Flash on Android. Desktop flash will soon follow. So if you are starting a new project, unless its expected lifetime is fairly short, forget about Flash.
Here's my requirement:
I often receive calls from unidentified numbers on my mobile phones. I would like an application which would use a reference list like this, and show me the carrier name and the area of origin along with the number on screen.
Mobile make : Sony Ericsson
Model : C902
Operating System: Propreitary
J2ME: MIDP 2.0
Here are my questions:
Is it possible to do something like this? I have installed a lot of java apps on my mobile, and all of them have to be launched seperately, can be run in the background, but they never seem to access anything native.
If it is possible, which area of J2Me should I start with, for creating an application that achieves the above requirement?
If it is not possbile, what are my alternatives?
I'm pretty sure this isn't possible. I dabbled in J2ME for a while, and came to the conclusion that it's basically just a big joke hard to do anything meaningful. Sorry.
can be run in the background? yes using Push Registry. access anything native? it depends on which native thing you want to access.
It is not possible.
On this model, you don't have alternatives, but on Symbian you can try Qt with help of Qt Mobility Project
I have been asked to find out if its possible to modify the default screen on a mobile phone with jme. Basically the screen that the phone shows when its on but doing nothing but which usually shows the network and nearest tower info.
My understanding of JME is that this is not possible. One would have to use symbian for this or some older protocol like USSD?
thanks
It is not possible to modify the default screen of a device with J2ME. You need a native application (Symbian, Windows Mobile) to do so. J2ME lays in a sandboxed environment and has many restrictions on what you can access. An application can only be started by the user and can't run as a service. It is also not possible to register an application to run at the start-up of the phone.
It has been discussed that MIDP 3.0 may address many of the above issues, but I don't think it will ever be available.
From an application lifecycle point of view, there are ways to approximate what you are trying to do but they almost unvariably require handset manufacturer support.
If you have a choice, the Sony Ericsson JP8 platform has non-standard extensions to JavaME that can help.
Accessing telephony information, however will be a major issue. Look for a handset that implements the cbs protocol of JSR-120, it could prove useful.
Accessing the phone idle/standby/main screen on Series60 (Symbian) phones will require nokia support too, BTW.