"Invalid Application. Delete?" only when compiled with a Nokia SDK - java-me

I'm developing a piece of software for my University and am currently attempting to implement NFC functionality which requires me to move from my standard Sun wireless tool-kit platform (implemented through NetBeans) to a Nokia platform (also implemented through NetBeans).
The problem is, whenever I compile the code with the Nokia platform implementation and run the program, on the Nokia phone I have or in the emulator, the phone displays a box stating "Invalid Application. Delete?" with a yes/no answer. This stops the installation of the application. The strange part is that if I compile the exact same code with the Sun platform implementation it runs without any issues on the Nokia phone. I have tried this with two different Nokia SDKs (the Series 40 Nokia 6212 NFC SDK and the Series 40 5th Edition SDK) with the same results.
What is the Nokia SDK doing differently?

There seems to be some kind of discrepancy between a project created using a Sun platform and a project created in a Nokia platform.
Although the original program, initially created with the Sun platform, compiled with the Nokia platform caused the application to be invalid, when I created a new project from scratch using the Nokia platform and just copied the source of the original program over the program worked. There is no discernible difference in the JAD/manifest files between the two.

If you've copied source code, you may have not copied the "manifest.midlets", i.e. tells the OS which "forms" to create. You'll usually find this in the project properties.
(e.g. in NetBeans IDE - Application Descriptor, "Midlets" tab - it shouldn't be empty).

Make sure that the following attributes (key:value pairs) are in the JAD file and also the manifest file in the JAR file:
MIDlet-Name
MIDlet-Version
MIDlet-Vendor
MIDlet-Jar-URL
MIDlet-Jar-Size

Related

Does Android Things Developer Preview 6.1 support Google Cast

Does NXP i.MX7D support Google Cast via Android Things?
Android Things Version: Developer Preview 6.1 which has 11.6.0 Play Services.
We need to show the UI on external displays like TV with Android Things, but the Google Cast feature does not seem to work with Chrome Cast.
To Test the code we manipulated our source code, so that it can run on Android Device; which runs perfectly fine. But when we try it on Things, it does not discover any devices to cast.
We also tried similar procedure with the Google Sample - CastRemoteDisplay-android
The above sample works on Android Devices but the same does not work on Android Things 6.1 developer preview; after making required changes to run on Things
We also tried different Play Services versions from 10.x and 11.x
We also tried to change the API level from 23 to 27
But all results the same
NOTE: I am not including any code or stack trace as I feel it is not required. But if any one demands will post the required logs
After lots of trial and research, I found out that the version of Play Services installed on Things Developer Preview 6.1 does not support it. It lacks GMS Core, because of which currently not possible.
In the mean time I'll try to search and side load OpenGapps with GMS Core, but I am not sure if it will work

Where did lcdui go, in JME SDK 3.0+?

I want to write a tiny "hello world" J2ME MIDlet. In a sample like this one, classes in javax.microedition.lcdui.* are used for display output. When I try to compile it in Eclipse, I get the error,
The import javax.microedition.lcdui cannot be resolved
I've installed JME SDK 3.4, and I'm able to run MIDlets that don't import javax.microedition.lcdui.*. I read somewhere that lcdui can be obtained from the wireless toolkit; and Oracle says that the wireless toolkit has been integrated into JME SDK as of 3.0+.
So why can't Eclipse find it?
OK, I think I know the answer now.
I got back to the JME SDK 3.4 documentation page on Using Sample projects, and created and ran an instance of UIDemo. It uses lcdui classes, but it runs flawlessly - no errors about inability to resolve javax.microedition.lcdui.*.
The difference appears to be that the working sample uses different libraries than the one I tried at first. The first one uses org.elipse.mtj.JavaMEContainer/Oracle Java(TM) Platform Micro Edition SDK 3.4/IMPNGDevice1,
while the one that works uses org.elipse.mtj.JavaMEContainer/Oracle Java(TM) Platform Micro Edition SDK 3.4/JavaMEPhone1. They contain different sets of jars, e.g. the working one contains midp_2.1.jar, while the earlier one has impng_1.0.jar.
A follow-up question might be, why doesn't IMP-NG have lcdui in it? Well, those who pay attention to what they're doing will have read that
This JSR [for IMP-NG] will define a J2ME profile targeting embedded networked devices that wish to support a Java runtime environment similar to the Mobile Information Device Profile (MIDP) version 2.0, but that do not provide the graphical display capabilities required by MIDP 2.0.
The Information Module Profile - Next Generation (IMP-NG) will be a strict subset of MIDP 2.0, where at least the APIs relating to GUI functionality (the LCDUI) are removed. Functionality not already present in MIDP 2.0 is not anticipated or desired. "
The next question might be, why did I end up selecting IMP-NG when I was going through the tutorial... when I really do want a MIDlet that does something graphically? But I'm not sure I care, now that it's working.
The new me sdk 8.2, as I understood after browsing all class and in packages, does not provides any class to develop user interface. not like sdk 3.4, that have many graphical components.

Generating netbeans project with Lwuit

I am trying to generate a netbeans project with Lwuit editor. But gets this error message that some library are missing and that WTK 2.5.2 CLDCC Cannot be found. any idea on how to fix this
http://www.oracle.com/technetwork/java/javame/javamobile/download/lwuit/index.html
Is the location of the library that you must download.
Additionally you may need the wireless toolkit though I am not sure why.
http://www.oracle.com/technetwork/java/download-135801.html
If you are writing for mobile devices I strongly recommend that you check out Codename One which is the open source product developed by the original designers at Sun of lwuit. http://www.codenameone.com/

Running J2me apps on Android phones

Is it possible to run J2ME apps on Android phones? If so, what is the installation procedure?
Otherwise, is it possible to convert .jad files to .apk? In this case, what is the procedure.
(I have already tested the procedure offered by netmite but it doesn't seem to work.)
Using this site http://www.netmite.com/android/srv/2.0/getapk.php you can convert your J2ME application in to Android Application. You need to just supply your .Jad & .Jar file in it and it will generate Android's executable file .apk for you.
However in it doesn't able to convert all the feature of Java ME to Android, but basics can be easily converted.
You can try phoneME, netmite j2me app runner, jblend, jbed like jeme emulators in android. For now, phoneME is the best. you can get various version of phoneME here http://davy.preuveneers.be/phoneme
You also need OI file manager to select files in phoneME.
A complete guide can be found here http://w3epic.com/run-java-apps-j2me-on-android-devices-guide/ for rest of other emulators (if you want to try).
#dennis
I got it, thanks.
MicroEmu open source project hasn't been mentioned yet, and here it goes: https://code.google.com/p/microemu/
I searched for a good JavaME emulator for Android for a long time, and finally found one. This here is what you need:
http://davy.preuveneers.be/phoneme/
No doubt the best there is for Android.
Added 15th January 2016:
Reply from the author of phoneME, Davy Preuveneers, in regards to the Android 5.0+ issue commented by Álvaro Gutiérrez:
Hi,
I am testing on a Samsung Galaxy S4 running Android 5.0.1, and the
"phoneME Advanced - Foundation Profile + MIDP FullHD Resolution" build
seems to run just fine on this device.
Also, following this thread
Position Independent Executables and Android Lollipop,
I ran:
$ readelf -l libcvm.so | grep -i "file type"
and it reports:
Elf file type is DYN (Shared object file)
So according to the website this is OK.
However, for the CDC and Foundation profiles (console like
applications), there is indeed an issue where you get this error:
"Error: only position independent executables (PIE) are supported"
However, for those 2 profile I call a native executables and redirect
the native stdout/stderr streams to Android, whereas for the MIDP dual
stack I load a library and create a complicated wrapper to get things going.
I can recompile with -fPIE and -pie options but will then end up with
binaries that are no longer backwards compatible with devices running
Android 4.0 and below. That is why I added some additional builds to my
website for Android 5+ devices:
http://davy.preuveneers.be/phoneme/?q=node/10
Best regards,
Davy

Can A Midlet invoke another Midlet?

I been looking around and at sources like this one they say that a Midlet can invoke another if they are in the same suite, or if they are in the same namespace and in the same jar file.
I do not understand what a Midlet-Suite is?
Also after searching through the web I did not find any documentation or code examples for One Midlet invoking another Midlet.
A MIDlet suite is basically the JAR file. There are many J2ME applications that contain several MIDlet classes in the jar, see some of Sun's examples that come with WTK.
Edit: There's an example called MMAPIDemos that comes with sun's WTK that uses 3 MIDlets in one suite.
The other replies are pretty much taking care of your questions about MIDlet Suites but I would suggest reading the MIDP specification to get the information first-hand:
http://www.jcp.org/en/jsr/detail?id=118
On recent phones (Series60 5th edition from Nokia Sony-Ericsson and Samsung, other Sony-ericsson phones), the Content Handling API (CHAPI) is supported for MIDlet-to-MIdlet invocation.
That's JSR-211. You can read the specification for that here:
http://www.jcp.org/en/jsr/detail?id=211
The latest version of the Nokia Java Developers Library will contain more explanation:
http://www.forum.nokia.com/Tools_Docs_and_Code/Documentation/Java/
The latest JavaME SDK will contain CHAPI code examples:
http://java.sun.com/javame/downloads/sdk30.jsp
Edit: CHAPI is also available on non-Symbian Nokia phones from Series 40 5th Edition, Feature Pack 1 onward, according to the Nokia Java Developers Library. You can find which nokia phone is running which version of Series40 at:
http://www.forum.nokia.com/devices/matrix_all_1.html
You can try PushRegistry as a more generic way. You should be able to launch MIDlets from other suites as well. Try this link for more information.

Resources