Latest posts from Codename One.
Blog

Contribute to Codename One during Hacktoberfest
It’s Hacktoberfest time! 🎃 Contribute to Codename One for Hacktoberfest to give back to open-source this October. We’re excited that Codename One is participating in Hacktoberfest this year. Now in its eighth year, Hacktoberfest is a global online festival aiming to drive contribution and involvement in open source projects. We encourage contributions from the Hacktoberfest community. People of all backgrounds and skill levels are welcome! ...

Moving the Support to Reddit
We have moved the support to Reddit on the subreddit r/cn1 for open discussion, support and also to allow the users to help each other. We used Google Groups as our main/secondary support channel for a while now. It sucked, but it was a shortcut to get things going and like many things, it just stuck. A couple of weeks ago we made the decision to create a new subreddit r/cn1 and move our support to that sub. ...

Announcing CodeRAD 2.0 Preview
We are proud to announce the immediate availability of the CodeRAD 2.0 developer preview. CodeRAD is a modern MVC framework for building truly native, mobile-first, pixel-perfect applications in Java and Kotlin. CodeRAD 2 builds upon the solid foundation of CodeRAD 1.0, and adds several new features aimed at increasing component reuse, and improving developer experience. Declarative View Syntax First among the long list of new features included in CodeRAD 2 is the ability to write your View classes in XML. ...

Debugging in Production – How to move fast without breaking things
Learn how we debug our backend servers and provide fast updates without breaking deployments. Mark Zuckerberg famously quipped that Facebook works under the “Move fast and break things” motto. We can write all the unit tests in the world, have the largest QA pipeline but still bugs slither into production. That’s just a fact of life which he chose to celebrate. ...

New CSS Units in Codename One Apps
We’ve added some new units that you can use for specifying things like margin, padding and font sizes. You can use each of these units directly in your CSS stylesheets. We’ve added some new units that you can use for specifying things like margin, padding, and font sizes. These units are rem, vh, vw, vmin, and vmax. You can use each of these units directly in your CSS stylesheets, and there are corresponding style constants for each of these so that you can use them directly in your Java code. ...

Moving to API Level 30
We will update the build servers to target Android API level 30 this Friday. The API level change should be seamless to most of you but might impact some edge case functionality and cause some native/cn1libs to fail in odd ways. So be sure to do extra checks on Android when building a new release. This change is mandated by Google who require that you target the latest Android version by August of this year. ...

Tips for the Javascript port of Codename One apps
This blog post contain tips for working with the Javascript port of Codename One apps. Sending Messages to Outside Webpage Problem You want to send a message from your Codename One app to the webpage that contains it. Solution You can use CN.postMessage(), in Codename One to send the message. The message will be dispatched to Javascript event listeners in the outside webpage that register to receive cn1outbox events. Sending a message from Codename One to the outside webpage: // The Java side MessageEvent message = new MessageEvent( null, // event source... we'll leave it null "Hello", // The message to deliver 0 // Optional message code. ); //Dispatch the message CN.postMessage(message); Receiving messages from Codename One in outside webpage: // The javascript side window.addEventListener('cn1outbox', function(evt) { var message = evt.detail; var code = evt.code; ... }); Discussion The CN.postMessage() method allows you to send a message to the native platform. When deploying as a Javascript app, these messages are converted to custom DOM events and dispatched on the window object. The event name is “cn1outbox”, so you can receive events like this from the “javascript” side by registering an event listener for these types of events on the window object. ...

How to detect Jailbroken or Rooted device and hide sensitive data in background?
The following recipes relate to security of Codename One apps. This includes detecting Jailbroken or Rooted device and hiding sensitive data when entering background. The following recipes include tips on making your Codename One apps more secure. Detecting Jailbroken/Rooted Device Problem You want to detect whether the device your app is running on is Jailbroken or Rooted. Solution While there is no way to know whether the device is rooted with 100% certainty, you can use the CN1JailbreakDetect cn1lib to to make a good guess. ...

Android App Bundle Support
We have added Android App Bundle support which will become the required format for submitting apps to Google Play. A few months ago, we added Android App Bundle support and forgot to tell anyone… These things sometimes happen in a fast-moving startup… Well, better late than never. To try the App Bundle support, use the build hint: android.appBundle=true This will produce the regular APK and the app bundle file which you should be able to upload to Google. ...

Moving to Xcode 12
Apple updated their requirements for App Store submissions so new apps must be built with Xcode 12. As a result we’ve updated our build servers to the latest Xcode 12.4 release. This isn’t on by default yet so if you need it this week you’ll need to use the build hint: ios.xcode_version=12.4 After the weekend this will be the default so if you don’t need to submit a build to Apple this week you can just ignore this. ...

Building Codename One From Source – Maven Edition
Learn how to build Codename One from source and use this “local” version in your Codename One projects. Tip This post is targeted at experienced Codename One users. If you haven’t built an app with Codename One before, I recommend you start with this Getting Started tutorial (for Java) or this tutorial (for Kotlin). One of the benefits of moving to Maven is improved project hygiene. It is now trivial to build Codename One from source. ...

Publishing Codename One Libraries on Maven Central
One of the cool things about Maven is Maven Central - the repository that contains every version of every Java library (that has been published on Maven central at least). Once your library is published, it can be used by other projects by copying and pasting an XML snippet into their pom.xml file. In this article, I describe how to publish your Codename One libraries to Maven central so that app developers can use them in their projects. ...