I create j2me application with codenameone and it works well in Nokia phones, however I wanna install or run it on Samsung devices (for instance S8300) I'll get error.
How can I fix this error?
I searched for this device's details and I found it doesn't have operting system but it can run java with MIDP2.0. What can I do for these device types? How can I run it on these devices?
Thanks in advance.
Check that you didn't use Java 5 language features and limited yourself to the CLDC 1.1 API specification in terms of classes such as java.util.
Codename One includes support for these features which work well on Nokia where the VM is more compliant but fails on some devices when these features are used.
Several things things may be the problem:
1) the jar file is to big. Java device have often constraints for max size of jar file, some of them unbelievable small. try to install a smaller jar file, like a hello world.
If this is problem, make sure you use "obfuscate", as it also removes unused code from the jar file.
2) Depending on operator branding, Samsung devices often do not allow to install the jar file directly from PC (with bluetooth or usb cable) :-(
What is possible only is called OTA-Download. There you need to create a jad file and a jar file, put them on a webserver, and call the url from jad in the mobile browser of the device.
You need to change the MIDlet-Jar-URL inside to have the absolute url of the jar file on your web server.
This is all quite complex. to check that your webserver is correctly set up and that that jad file has no syntax errors, you can use my jad checker:
jadcheck.appspot.com
We must create UI by hard coding not using lwuit or codenameone designer.
cause of some devices that don't have an OS and just support MIDP can't run these type of applcations which are create by lwuit or codenameone desiner.
Maybe it cause of resource file path in devices!
Related
After getting out of a mode of procastinating, I've finally gotten to the item on the projects todo-list that says "Run on virtual device to see why it crashes".
My project is a libgdx application that I plan on porting to various platforms, the two most important ones being desktop and android.
During development I've exclusively used the desktop launcher, as it's a lot easier to fire up when just checking minor things.
I did build an .apk at one point just to see if it'd run out of the box, but it didn't. Now that I've tried via the virtual device, this is what the log says:
com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: rifleman.png
The same goes for any other assets that my game uses. The files are all placed in projectname/android/assets, as I remember learning way back that this was the way to go.
The virtual device I tried with is the stock Nexus 5, but I tried running the .apk by uploading it to my actual phone with a crash right after start, and I assume the problem is the same and is therefore unrelated to the test-platform.
I am currently not using an assetmanager, as implementing this is scheduled for after getting the basic core mechanics up and running. In the mean time I'm loading them as such: new Pixmap(new FileHandle("rifleman.png"));
Using android-studio 2.2 on Linux Mint 17 Cinnamon.
Please comment if more info is needed.
Use Gdx.files.internal() instead of FileHandle().
From filehandle(string) method info
Creates a new absolute FileHandle for the file name. Use this for
tools on the desktop that don't need any of the backends.
Do not use this constructor in case you write something cross-platform.
I'm using Mono For Android (probably will use MonoTouch too soon) and MVVM-Cross to port of a Windows Store app (Work on progress by another team, in Parallel).
Unfortunately the Windows store app team started of without using MVVM-Cross. That lead to some Windows specific libraries (like Windows.ApplicationModel.Resources) being scattered across code that should be portable across other platforms (for eg "Windows.ApplicationModel.Resources.ResourceLoader" was used for localization).
I was wondering if there's a cross-platform alternative (or may be a mvvm-cross plugin) for some of these windows libraries. Or may be guidance on how to create my own plugin/alternative.
There is a resourceloader plugin which uses windows package content files and android asset files.
See https://github.com/slodge/MvvmCross/blob/v3/Plugins/Cirrious/ResourceLoader/Cirrious.MvvmCross.Plugins.ResourceLoader.WindowsStore/MvxStoreResourceLoader.cs
It is used in (for example) the customer management sample in order to load an XML data file - see https://github.com/slodge/MvvmCross-Tutorials/blob/master/Sample%20-%20CustomerManagement/CustomerManagement/CustomerManagement/Models/SimpleDataStore.cs
It's also used internally in the json i18n plugin.
If you want a different implementation on one platform, then you can override the plugin for just that platform.
If you want a different implementation on all platforms, then it should be easy to create your own plugin, or to inject implementation of an interface on each platform. See the explanation of mvvmcross IOC in Instantiation of ViewModels and Service classes
Currently I am using jad to set the http and Bluetooth permissions.
But I have a problem with this approach. Some of the handsets does not have support for
bluetooth API, so the phone is not allowing the installation of the application as it does not support the bluetooth API.
Is there any alternate way of setting these permissions?
This is the solution:
MIDlet-Permissions-Opt: javax.microedition.io.Connector.bluetooth.client
This is how you can specify optional permission.
If a handset does not have Bluetooth API then the Java Virtual Machine does not have javax.bluetooth package. Because of this the handset may not allow you to install the app.
Create another version of your app without any usage of the javax.bluetooth package and try installing again.
You don't have to specify these permissions at all. The MIDlet will work properly without them.
I need to update an application JAR file by sending a minimal incremental update of my J2ME code and res/ folder. What is the best way of doing this. This JAR gets installed on a phone. In so doing, I want to minimize the size of the update I send to the phone. I am developing with Eclipse for Nokia N97 SDK.
You can't update individual classes or resources on the fly. You could download new resources, and save them either to RMS or the file system using JSR75.
Beyond that, you'll need to install a new JAR.
I have implemented following code to upgrade application
platformrequest("URL TO JAR FILE");
I am checking if the jad file residing on server has more value in the custom field Application-Version than the current one then the platformRequest will get called.
every thing fine
but only one problem I have installed my app in memory card and if I updateusing above mentioned technique.
I am having new version installed saperately..
instead of this I want my older version application to be upgraded [replaced by newer]
in jad file ony I change the Application-Version Field rest every thing are same as the local installed appliction..
and I want my app to be replaced in memory card only.
what phone are we talking about?
In essence it should not matter where the app is located, it should update.
Make sure the platform request should point to the jad of course
I don't think you should be using a custom field/attribute for this.
Are you using the MIDlet-Version attribute in your application's manifest/JAD file? This attribute is used by a device's AMS (application management software) to determine if your pointing to a newer version.
See here for a description of the standard MIDlet attributes.