How to install a Java ME app on Samsung phone? - java

My phone is supposed to be able to run: JavaTM: MIDP 2.0, CLDC 1.1 based apps. However, no matter which app I try to install on it, I get the error: Downloaded JAR are invalid
I've tried to build Java ME projects on Netbeans, using MIDP 2.0 and CLDC 1.1 as specified. The apps are simple, using the auto generated code that comes with Netbeans, to display a hello world message. It works in the emulator however when I transfer the .JAR to the mobile, I get the above error.
This is the model and specifications of the phone.
Does anyone who developed any Java ME apps for this or any similar Samsung phones, have any idea of what I need to do?
Edit: Contents of jad file:
MIDlet-1: Midlet, , hello.Midlet
MIDlet-Jar-Size: 1565
MIDlet-Jar-URL: MobileApplication1.jar
MIDlet-Name: MobileApplication1
MIDlet-Vendor: Vendor
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0

Although many phones allow additional methods of installing MIDlets, the only standard way that they are all supposed to support according to the JavaME specifications is:
put the jad and the jar on a web server somewhere anybody can access them. choose a server that your mobile network operator doesn't block.
open the phone web browser. make it go to the jad file URL.
the web browser should download the jad file, realize what it is, make the phone install the application.
the internet connection of the phone should be using the cellular network at the time of install (no wi-fi...)

Maybe your filename is too big. "MobileApplication1" has 18 characters. Try to reduce both names (jad and jar) to equal or below 13, for example: MobileApp.jad and MobileApp.jar
Place both files at SD Card and open Jad file.

Related

Listing folder content fail in Java Android with AccessDeniedException. How can I give authorization?

I've got an app that uses Kotlin/Java Files.newDirectoryStream
I got the error message
java.nio.file.AccessDeniedException: /storage/emulated/0/AnkiDroid/collection.media
This folder exists, it is indeed a directory according to File methods. I can access its content if I already know the name of the file I want to access. I.e. asking a webview to show /storage/emulated/0/AnkiDroid/collection.media/image.jpg works. Which also seems to indicate I still have quite some reading permissions here. The only thing that fail in my app is listing the content of the folder which fails.
I can see the folder content through samsung file browser and through adb shell's ls. However, I do not see any permission settings. Actually, I thought that android default file system did not have permissions the way linux has.
Actually, what is even more confusing is that I've two android devices, and this operation fails on one device and work correctly on the second one. I installed it on both device using android studio tool to compile and install from source, so theoretically they are in the same state. They have the same permissions. The folder in both case was created with the same app.
If it helps, the app source code is on https://github.com/ankidroid/Anki-Android/

Not supported In Simulator for jar file (CodeName One)

I created an application that uses MediaRecorder, it creates a file in my application directory and records into it, it worked fine.
But later i decided to make a desktop version of it without sending it to the build server by following the instructions i found here
My app is working fine, but i don't think it does the recording, infacts it throws a null pointer exception and the file path it shows when i try to show it with a dialog is something like this file://homeaudioSample1410359700375. Which makes me know that it seems to behaving like it is running in simulator. So i decided to run the jar from the command prompt and what i got was an error: not supported in simulator. What is the solution to this as i want the app to also run on non-mobile platform, or is there no other way around this except sending it to the build server.
Media recorder isn't supported in the JavaSE port of Codename One.
You can use a native interface implementation for JavaSE support. Media is just really problematic for desktop Java...

Android java app installation under the hood

I am trying to understand what exactly is going on when you install an application (APK) on an Android device. I guess that files are are extracted from the package and copied somewhere on the device.
Are there other steps going on? For example, is the package name of the application written somewhere in the OS like in somekind of registry?
Is the application version number written as well somewhere or the OS reads the xml manifest of the application to know its installed version?
This is related to another question where I suspect that some data was not erased correctly during the uninstallation of a debug app and I am trying to find what that might be.
There will be files/dirs created in various locations, not necessary in all possible locations for every app though, it depends on how the app is configured.
This list is not necessarily complete.
Files/dirs:
/data/data
/data/app
/data/app-asec
/data/app-lib
/data/dalvik-cache
/data/local/tmp
/mnt/asec
/mnt/obb
/mnt/sdcard/Android/obb
/mnt/sdcard/Android/data
Your app will also get an entry in these files:
/data/system/packages.list
/data/system/packages.xml
/data/system/appops.xml

how to run java applications on mobile?

hi
what do i need to do in order to make my java app executable on a mobile (let's say Nokia Symbian for example) . Do all jar files run on mobiles???
is there a certain way of programmings am supposed to use ?? are there specific classes am supposed to use???
Do all jar files run on mobiles???
No
is there a certain way of programmings am supposed to use ??
Yes , you need to use j2me for specific MIDP CLDC platrofm . have a look here
are there specific classes am supposed to use???
You can use the classes available over the platform , alternatively you can also add the external library
Easy, seems like your about to have a stroke. Start reading some articles about getting started on J2ME, try these ones out:
Link 1
microjava.com
forum.nokia.com
You have to know, that depends on the your orientation of you application, not all applications runs in all cell phones, is like in computers, a Windows application won't work on Linux, unles you use a Virtualizer. My point is, start reading all the documentation you you cant, and take it slow.
Some OS's like Symbian Can run java package file i.e. .jar files.
And Android lacks that capability.
Phones with MDIP runs .jad files that is a Java app made using the J2ME API.
Android generate Dalvik Bytecode and run .apk packages on the phone.

Java Midlet Deployment

So, I've develop a simple hello world midlet using the Samsung SDK 1.1.2 and I've Packaged the midlet. Now I have two files (a JAR/JAD) combination. How do I get these installed on my phone?
As you can tell from the question, I'm new to phone development. Trying to deploy to a Samsung handset on ATT.
I'm trying to test out the entire development cycle - the emulators work great for writing code but I really need to make sure the Midlet works as expected on the target phone.
Suggest you read up a little on OTA delivery of applications, for background.
You have a number of options for deployment, here's a few.
Connect your handset to a computer via bluetooth, cable, or wifi and copy the JAR file over.
I'm not sure if Samsung support this, but other handset manufacturers certainly provide 'manager' software you can download and install on a computer to do this. If your app relies on user data in the JAD this may not be an idea option, or you could include default data in the JAR.
Place your JAD and JAR file on a web server you have access to, from which they can be downloaded to your phone. You'll need to ensure that the MIME types for the JAD and JAR files are set correctly, they may not be by default. Exactly how you do this depends on your server - here's an example method. (Presumably you have a web/data access service from AT&T.) If all is well you can fetch the JAD file from the phone's browser and the handset will then prompt you to confirm you wish to proceed and download the full JAR and install. Mobile Network Operators have a variable attitude to supporting JAD and JAR access, for example you may find you have to run your server on port 80 or 8080 for it to work in some cases.
Join a service that will host an application for you. One I'm aware of is GetJar. I'm not sure of the details, but doing this will mean you don't have to run your own web server.
Apart from basic deployment you might consider signing your application - a process that basically allows you to assert your 'true' identity to a handset. The advantage of doing this is that signed applications can present fewer network access confirmation dialogs and the like to the handset owner. Also, when the application is being deployed, the user will see a message about unsignedness that might include the word 'untrusted' or similar, and that can be off-putting. (Having said that, some major applications out there have been unsigned.)
Hope that gets you started.
You can certainly copy the jar/jad over via usb or bluetooth, but the Samsung devices I've used will not install a file that's been manually copied over.
Unfortunately the other methods are significantly more work.

Categories