Codename One Instant is an iPhone and iPad app that runs your Codename One code on the device without a build. You can write a program in its editor, or send your project from your computer, and it starts in seconds: no build server, no certificate, no cable.
It’s a development tool. Your code runs in an interpreter, which makes it slower than the app you ship, and the app you ship is still built the usual way. What Instant gives you is a fast loop on a real device: the real screen, fonts, touch, density, and network.
Writing code on the device
The app opens on a project called Hello. Tap Run at the top right: the source compiles on the device and its screen appears. A red Stop button floats over the running program; tap it to return to the editor.

Compile errors appear in the console under the editor. Tap one to jump to its line. Typing a dot after a variable or a class name lists its methods, and class names and keywords are suggested as you type.
On a phone, the title opens the project list, where you also create projects, delete files, and reach About and help. The strip under the toolbar holds the project’s files, and the + chip adds one. On a tablet the files and projects sit in a sidebar instead.

Running your project from your computer
The computer icon at the top left of the editor opens the pairing screen.

From your Codename One project, run:
mvn compile cn1:push # the iOS simulator, or a phone over USB
mvn compile cn1:push -Dcn1.push.lan # a phone or tablet on the same Wi-Fi
mvn compile cn1:push -Dcn1.push.device=192.168.1.50
mvn cn1:push-stop -Dcn1.push.lan # stop what the device is running
# Gradle: the same properties, passed with -P
./gradlew cn1Push
./gradlew cn1Push -Pcn1.push.lan
./gradlew cn1PushStop -Pcn1.push.lanThe first time, the command prints a six-digit code; type it on the device and press Pair. The device then asks whether to accept the computer just once, or always. After that, each push starts your app at once.

The whole project is sent: every source file, plus your theme, CSS and images, so the app looks like yours. It starts the way it does on a device, through your Lifecycle class’s init and start, or through a main method if the project has one. To choose a different entry point:
mvn compile cn1:push
mvn compile cn1:push -Dcn1.push.main=com.example.OtherA running program carries a Slow interpreted mode label. To stop it, long-press that label, tap Stop the program on the pairing screen, or run mvn cn1:push-stop (Gradle: cn1PushStop). Settings in the editor menu moves the label to another corner or hides it.
View and edit source shows everything that runs. Edit saves the received program as a project in the editor, where you can change it and run it again.
Only a paired computer can send or stop a program, and only over your local network. Unpair all computers on the pairing screen removes every pairing.
Versions
The app is built against one Codename One version, shown on the About and help screen. When your project uses a different version, the device asks before running it, because a program built for another version can fail in ways it otherwise wouldn’t. Use the version the app shows.
What works
Any Codename One application that’s plain Java should run unchanged. That includes:
Subclassing framework classes, such as
Form,Container,ComponentandLifecycle, and overriding their methods, includingpaintand calls tosuper. The framework calls your overrides as it would in a built app.Your own class hierarchies, however deep, abstract classes and interfaces, implemented by your classes or by framework ones, such as
RunnableorActionListener.Lambdas, method references, inner and anonymous classes, enums, generics and exceptions, including your own exception types.
Collections, strings and the rest of the Java API that Codename One supports on a device.
Threads,
synchronized,waitandnotify,callSeriallyandinvokeAndBlock, blocking dialogs and network calls.Your theme, CSS, images and other resource files: everything in the project goes to the device, and your code loads it the same way it does in a built app.
The camera, media, location, Bluetooth, on-device machine learning, augmented reality and the health store reach the real device APIs. iOS asks for permission the first time your program uses one.
When a program fails, the stack trace names your classes and line numbers.
What doesn’t
Native code. Your project’s native interfaces and a cn1lib’s native code can’t be sent. The Java half of a cn1lib runs, and NativeLookup returns an implementation whose isSupported() is false, so a well-written program carries on without the feature.
Anything that belongs to the app itself. The installed app’s name, home screen icon, launch screen, URL schemes, push notifications, background modes, extensions and widgets are Instant’s, not your program’s. Build hints don’t apply. A permission Instant doesn’t declare can’t be used.
Real purchases and real sign-in. In-app purchase, Facebook login and Google login are simulated. Every product costs nothing, every purchase succeeds, and login returns a token marked as fake. A dialog tells you the first time your program uses one. Use this to test the code around the call, then test the real thing in a built app.
Car apps. CarPlay isn’t available.
One Java detail behaves differently, which ordinary code doesn’t depend on:
Storing the wrong type into an array of your own class, through an
Object[]alias, isn’t caught with anArrayStoreException.
Performance
Only your own code is interpreted. The framework, the Java API and the device APIs run at full speed, so a typical screen, one that builds a form, lays it out and reacts to taps, feels normal.
Your code itself runs about a hundred times slower than in a built app. You notice it where your own code runs many times a second:
a
paintmethod doing a lot of drawing, or per-pixel work;animations and game loops;
heavy computation of your own, such as parsing, or sorting a large list with your own comparator. The list and the sort are full speed; only your comparator isn’t.
Don’t measure performance here. A frame rate or a timing taken in Instant says nothing about your built app.
Two safety limits keep a broken program from freezing the app:
Code that holds the event thread for more than two seconds without returning, such as an endless loop in a button handler, is stopped with an error. Move long work to a background thread, as you would in any app. Time spent waiting inside
invokeAndBlock, a blocking dialog or a network call doesn’t count.Recursion of more than 512 calls of your own code, ends with a
StackOverflowError.
Privacy
Instant performs no tracking and collects nothing. Your projects stay on the device, and the app only talks to a computer you paired yourself. The full policy is at https://www.codenameone.com/instant-privacy/.