Auto-renewable subscriptions provide, arguably, an easier path to recurring revenue than non-renewable subscriptions because all of the subscription stuff is handled by the app store. You defer almost entirely to the app store (iTunes for iOS, and Play for Android) for billing and management.Read More
Opening a demo or sample code from GIT is relatively easy if you are an experienced Codename One developer but for a lot of newer developers for whom samples are often more crucial this can be challenging. One of our solutions was placing the demos in the Codename One new project menu but that's probably not enough.Read More
Non-renewable subscriptions are really the same as consumable products, except that they are shareable across all of a user's devices. Auto-renewable subscriptions, on the other hand, will continue as long as the user doesn't cancel it. They will be re-billed automatically by the appropriate app-store when the chosen period expires, and all management of the subscription is handled by the the app-store itself.Read More
In-app purchase is ahelpful tool for making app development profitable. Codename One has supported in-app purchases of consumable and non-consumable products on Android and iOS for some time now, and with the next update we are adding support for subscriptions. For such a seemingly simple task, in-app purchase involves a lot of moving parts - especially when it comes to subscriptions.Read More
In my last post I demonstrated how to integrate a MySQL database into a Codename One app using Xataface as a web service layer. In this installment, I'm going to demonstrate how we can build an equivalent app using a Java web service layer.Read More
In the following series of blog posts I'm going to shift some attention to server-side development in so much as it can complement a Codename One client application. In this post I'll demonstrate how you can combine a MySQL database, a web-service layer, and a Codename One client to produce a "Contacts" app. I'm going to steal the Contacts code from the Kitchen Sink demo for the UI, but I'll implement a different datasource that loads the contacts from a remote MySQL database instead of from the phone's internal contacts.Read More
Codename One has always provided access to the device's photos and videos via `Display.openGallery()` but it hasn't provided an API to open arbitrary file types because this type of functionality was not available on most mobile platforms. Times have changed and most platforms now offer support for more than just images and photos, so we decided to provide access to this functionality as a cn1lib. Here is a short introduction to the cn1-filechooser library.Read More
The Codename One CSS plugin is a handy tool to style your app with CSS. This includes setting borders, padding, margin, fonts, colors, and pretty much everything else that you might otherwise do in the resource editor. However, there are some other cool things that this plugin can do for you, such as importing multi-images into your resource file. Let me demonstrate with a small snippet.Read More
FontBox is a mature java library for loading, manipulating, and rendering fonts in Java. It gives you direct access to the font glyphs so that you can perform effects or transformations on them. A couple of years ago, I ported FontBox to Codename One, but since CN1 didn't yet include support for drawing shapes, I made it dependent upon the CN1Pisces library, which did support drawing shapes. This was cool but it had some major limitations; the main one being that FontBox fonts could only be used to draw strings on Pisces graphics contexts, which can only be rendered to an image - not directly to the screen. This meant that you couldn't *just* use a FontBox font in your app (e.g. in a label or a button). You could only use it to write on an image.Read More
One of the compelling reasons to go native (vs say a web app) is to better integrate with the platform. One form of integration that is frequently handy is the ability register your app to handle certain file types so that it is listed as one of the options when a user tries to view a file of that type. Codename One supports this use case via the "AppArg" display property - the same, simple mechanism used for handling custom link types in your app. "feature X" from Java isn't supported. In this post I'd like to explain the "bigger picture" or why less is more...Read More
The Phoenix UI kit by Adrian Chiran is one of the best looking and most challenging template UI's I had to adapt in recent history. The breadth of the design is pretty challenging but it also has some elements that are really hard to adapt across platforms in a portable way.
Codename One's resource files contain a lot of details but it's sometimes hard to add elements into the resource file automatically. Recently I wanted to add a better way to add images directly in the new GUI builder. I considered several options and eventually decided to operate the designer tool automatically to do the "heavy lifting".Read More
The SQL demo has been on my "todo" list for months. It's really hard to create a compelling demo for something as boring (by design) as SQL so this was a big procrastination target. After we built the SQL explorer tool for the developer guide it became apparent to me that this could be the basis for the new SQL demo, just provide the ability to type in arbitrary SQL and see it work...Read More
In the previous template post I introduced a material design inspired theme. This time the theme I chose is simpler "cleaner" but not necessarily easier to integrate. I've had quite a few difficulties wrestling with Photoshop oddities (bugs?) that made this template painful, hopefully I've narrowed down the process enough so this should become easier.Read More
We get contacted quite a bit about the prospect of porting applications that were already written using the Android API. In this quick tutorial we will walk you thru the paces of converting a simple Android application to a Codename One application. We will also start with some basic tips covering the differences between Android and Codename One development.Read More
Generating a template from a PSD isn't hard but it isn't a trivial task either, in this recurring segment I will try to generate good looking Codename One templates from freely available PSD files. Since this requires some effort I don't think I'll be able to keep this as a weekly segment but I'll try to post such a template once every two or three weeks. If you know of a free PSD that you'd like to see as a Codename One app point me at it in the comments and I might integrate it in a future post!Read More
There are many Codename One resources for building native mobile apps but they are often all over the place, in this blog post I'll try to concentrate the best resources for people who already know Java and are looking to pick up Codename One. If you don't know Java yet please check out this post where we discuss resources for beginners to Java.Read More
We often build one app and sell it to multiple customers. After all, most customers ask for similar things with minor changes. E.g. if I build a restaurant app and then sell it to one establishment I can then resell it to another with almost no change at all...Read More
We've discussed codapps.io before, it's a MOOC (online course) that allows you to learn Java programming and uses mobile/Codename One as its vehicle. Our current documentation and tutorials can be quite intimidating to a person who is a complete Java newbie so this course is quite helpful in bridging that gap.Read More
I try all things, I achieve what I can.Opening with a Moby-Dick quote seems rather appropriate for taking on the kitchen sink demo. It often seemed like a task that is too big and unsurmountable as we were working our way thru it. In fact the version that we are releasing now has far less features and abilities than our original whiteboard... Read More
A lot of our focus in the past couple of releases has been around the material design icon fonts, they changed the way we build UIs. We also support arbitrary font icons, this features isn't limited to material icons and we blogged about it a while back.Read More
When picking up a new UI API people often start with a list of items. Lists are often used for navigation, logic and data so it's a natural place to start. Codename One's List class is a bad place to start though... It's complex and encumbered and has far better alternatives.Read More
I hoped todays post would cover the new Kitchen Sink demo but due to a couple of bugs we decided to postpone that to next week. In the meantime I'd like to discuss something I did there which is actually pretty cool and most developers have no idea that we can do Image Overriding.Read More
With the fix for issue #1694 we can now have a moderately simple method of creating an
AutoCompleteTextField that works with a webservice. This has been requested quite often and was quite frustrating to implement in the past it is now relatively simple with just a few lines of code.
Over the weekend LokeHansen posted a new series of youtube videos covering the process of creating a game in Codename One. I really enjoyed watching them as his teaching style is far more accessible than mine (I tend to be overly technical without noticing).Read More
We had a couple of posts in the past about the new GUI builder but we didn't have a "how to" guide yet. In this post we'll try to go step by step over the process of using the GUI builder and understanding its inner workings. We'll also try to clarify conclusively the role the new GUI builder plays in the toolchain and the migrations process from the old GUI builder.Read More
The charts demo is one of the most elaborate/messy demos we have as it was derived/ported from an aChartEngine demo. Since the Codename One charts are themselves a derivative of aChartEngine this makes a lot of sense but the demo is a bit big and hard to follow.Read More
We've been working very hard on updating a very ambitious demo for this week but alas it still isn't ready... In the meantime we decided to modernize the clock demo which is an important demo that is missing from the IDE's for some reason which is a shame because it's probably our only low level graphics focused demo...Read More
SocialBoo originated from the same app design vault set of designs that brought us the Chrome Demo. This demo uses a somewhat outdated but still reasonable gunmetal look, it also features different UI styles when running on a tablet/phone. Notice in the screenshot above that the UI for the demo differs when running in a phone/tablet and even changes when the tablet flips between portrait and landscape...Read More
Dr. Sbaitso is one of our newer demos. We wrote it for a workshop at JavaZone a couple of years ago and it proved to be an excellent tutorial on many complex abilities of Codename One. It captures images from the camera, rounds them, does dynamic search with a chat like bubble interface...Read More
Debugging Codename One apps on iOS devices has been documented well with a video for years, we didn't spend too much time outlining the Android counterpart mostly because we didn't really use it as much and it was far simpler.Read More
PropertyCross is one of our newer demos, due to that there was relatively very little work needed to modernize it and this resulted in a stunning improvement over the existing demo. During that process we also discovered a small regression due to changed in the web service we relied on.Read More
When we initially launched Codename One it was pretty hard to imagine todays apps. Menus and back navigation were miles apart when comparing Android 2.x and iOS 4.x... So we created a very elaborate set of abstractions (command behavior) that served as a set of patch framework we could live with for a while.Read More
This week we chose to modernize the very outdated Chrome Demo. This demo is one of our early demos developed during the iOS 4.x era. We licensed it's original design fromapp design vault and created a Codename One version of that original template. While the guys in app design vault modernized most of their templates to iOS 7 flat design they didn't do this for the Chrome demo.Read More
With the 3.4 release we discussed the process of modernizing the demos and the first one we picked for this task is the camera demo which is probably the easiest one of all the demos...
With the 3.4 release we discussed the process of modernizing the demos and also mention that we would continue the trend of building Codename One on top of itself. We now have a rough outline of what we are going to do possibly starting with the next plugin update.Read More
We finally uploaded the last of the 3 hello world videos covering Eclipse, which now joins the ranks of the NetBeans and IntelliJ/IDEA videos.
Check out the Eclipse version here...
As I mentioned last week we are redoing a lot of our videos and this video will serve as a benchmark to where we want to be in terms of production. We just released a modified version of the video geared towards IntelliJ/IDEA users here. We are really excited about the new IntelliJ/IDEA plugin we released a couple of weeks ago and this video shows off some of it's capabilities.Read More
We just published a new introduction to Codename One video, that we hope will set the bar for future videos from us (or at lease set the bar for the more important videos). This initial one is focused on NetBeans but we intend to publish similar videos for IntelliJ/Eclipse shortly. You can check out this video in the How Do I section right here.Read More
One of our most important posts from 2015 was Steves PSD to App: Converting a Beautiful Design into a Native Mobile App. This post included a very thorough step by step video guide walking thru the creation of a non-trivial UI design and ended with the introduction of Steve's CSS plugin for Codename One.
As we are close to wrapping up the developer guide update it occurred to us that this remarkably important tutorial isn't within the developer guide!
I was working on documenting the SQLite support in Codename One, you can see some of that work both in the db package and in the developer guide. As a demo for SQL I decided to just create a tool that allows you to type arbitrary SQL to execute it on the device and see the results in a
Beside being a cool example this can be a hugely powerful debugging tool to one of the more painful API's to debug on the device. You can integrate this as a hidden feature into your application and use it to debug odd "on device" issues by querying the DB!
A very common UI pattern is the 5 star ranking system. Up until recently we always had the same answer when developers asked us how to implement it: "Use toggle buttons (CheckBox)".
This is still not a bad answer but we think there is a "better" simpler way to do this thru the
Slider which was effectively designed with this usage in mind.
Just last week I wrote that we are making an effort not to add new features and we got foiled by a couple of new features. The main reason for this is paying customers who need to have a feature now. This makes it hard for us to focus completely, but it does keep the lights on here so we can't really complain.
To be fair, during this time we were able to almost double the page count of the developer guide from the 3.2 era to 576 pages at this moment and we still have a lot of work ahead of us in that department.
As you know we've been working a lot on the docs both the developer guide and the JavaDoc's, we nearly doubled the amount pages in the developer guide and we did it without "cheating" (e.g. cramming more stuff, increasing font size). You can see all that work in the developer guide section but what I want to discuss today is the new Component Gallery and Layout Gallery.Read More
Table is a composite component (but it isn't a lead component), this means it is a subclass of Container. It's effectively built from multiple components (but it isn't a lead component), this means it is a subclass of Container. It's effectively built from multiple components.Read More
JavaDoc source code embeds suck!
I love JavaDoc but it didn't age well. When you work with other tools (e.g. in the Microsoft world) suddenly the embedded samples look amazing and "search" functionality is just built in!
Why can't we have that?
JDK 9 is introducing new support for search but source embeds can be so much better and are a crucial learning tool...
I've written open source software since the 90's both for my own projects and for Sun Microsystems. When we founded Codename One open source was the only option!
We didn't choose open source with the goal of receiving code contributions. Contributions are pretty rare even in highly visible projects. We saw the true benefits of open source for a project like Codename One: trust.
Sizing images for multiple DPIs and device sizes is challenging. There are image quality and bandwidth considerations, especially when loading images over the network. The new Cloudinary cn1lib simplifies this process by preprocessing images on the server side, so that they can be delivered to the mobile app in the exact correct side and quality.Read More
We just released the first version of the open source CN1Cordova project on github. This means you can take a common Cordova/PhoneGap app, import it into NetBeans and build a native app using our cloud build servers without any changes!
Before we delve into the exact process of converting an app lets start by reviewing the exact benefits PhoneGap/Cordova developers can gain from Codename One. You can also check out the video tutorial and slides below.
A common trick for animating Components in Codename One is to set their preferred size to 0 and then invoke
animateLayout() thus triggering an animation to hide said component. There are several issues with this trick but one of the biggest ones is the fact that
setPreferredSize has been deprecated for quite a while.
This morning I was awoken by myself - or rather the 1985 version of myself. He (I'll refer to the 1985 version of myself in the 3rd person here forward) was in a panic and was yammering about something to do with changing history. He asked why my pants were inside out, and I wondered why he was wearing a life preserver. According to him, he had driven a time machine from 1985 to this day (October 21, 2015) in the future to stop me from making a terrible mistake. I asked him: "What mistake?", to which he produced a 3.5 inch floppy disk.Read More
The new Codename One CSS library enables you to create entire themes using only CSS, but in this post, I’m going to focus on its ability to automatically generate image backgrounds and borders for your apps.Read More
This is the third and final instalment in a series on integrating 3rd party native SDKs in your Codename One application. If you missed the first two chapters, I recommend you begin with part one before reading this tutorial, as it provides much needed context for the procedures described here.Read More
Codename One 3.2 is scheduled for Tuesday the 27th of October. In keeping with our successful 3.1 release we'll use a very short one week code freeze on the 20th of October at which point we will only commit crucial fixes with code review. I hope we can land quite a few new features for the release, the GUI builder is getting very close although its still a very rough product and will only be featured as a "technology preview" showing the direction we are heading rather than a final product.Read More
This blog post is part two in a three-part series on integrating 3rd party native SDKs into Codename One application. I recommend you start with part one in this series as it will give you much-needed context to understand the procedures described in part two and three.Read More
We are happy to announce support for local notifications on iOS and Android. Local notifications are similar to push notifications, except that they are initiated locally by the app, rather than remotely. They are useful for communicating information to the user while the app is running in the background, since they manifest themselves as pop-up notifications on supported devices.Read More
This past Thursday, we held our fourth webinar, and the topic was how to incorporate 3rd party native libraries into a Codename One app. I used the recently released FreshDesk cn1lib as a case study for this webinar. As the topic is a little involved, I decided to break it up into two webinars. In part one, we focused on the public API and architecture involved in developing a wrapper for a native SDK, and walked through the native implementation for Android.Read More
The excellent Parse4cn1 library just announced version 1.1. The biggest new feature is batch operations but there are a few others that could be helpful. Overall the library was pretty solid before the 1.1 version and this is a nice improvement on top.Read More
This will be the last installment of this tutorial which was pretty complete in the previous section already. We might have additional installments mostly for covering enhancements such as "invite a friend" and other similar capabilites but this is probably as good a place as any to finish the app and let you try it live.Read More
Codename One provides extensive support for designing beautiful user interfaces, but it isn't necessarily obvious to new developers how to achieve their desired results. A common workflow for app design includes a PSD file with mock-ups of the UI, created by a professional designer.Read More
A couple of weeks ago I created a simple social network app as part of the Codename One webinar. This app provided functionality similar to the Facebook app.Read More
We are starting the complete overhaul of our push implementation that will allow us to deliver improved push related fixes/features and provide more reliability to the push service. When we designed our push offering initially it was focused around the limitations of Google App Engine which we are finally phasing out. The new servers are no longer constrained by this can scale far more easily and efficiently for all requirements.Read More
On Thursday morning we rolled the cameras for chapter 2 of our exciting new webinar series. This time around there were far fewer (though not zero) technical issues, and we were able to share a productive hour of mobile app development in the company of our fellow coders.Read More
We decided to discontinue support for building without a certificate, this support was added initially because generating an iOS certificate was so difficult and we wanted developers to see that "it works" before committing to the expense. However, this process is wrought with bugs that are often hard to trace back and error prone. Added to that is the fact that we now have the new certificate wizard which makes the process simpler thus removing the final blocker (no need for a Mac).
We will block this functionality in the build servers by next week and thru the plugin after that.
When StartApp first launched a few years ago, they were a unique innovative new monetization channel to make money on Android.Read More
The chat UI is what we've been working at and in todays post we are going to build exactly that!
Even better... We'll integrate with Pubnub to make the app almost fully functional as a rudimentary chat app, which is pretty spectacular. In this section we'll cover UI, storage (externalization), Pubnub & its JSON API... We'll also use `InteractionDialog` to show notifications of incoming messages...
Before we get started you will need to login to pubnub.com and sign up for an account where you will get two ID's necessary when subscribing and pushing.
Tuesday morning I held a webinar on Java mobile development using Codename One. First of all, I'd like to thank all who signed up and attended. Unfortunately there were some technical difficulties with the Webinar software that caused some major glitches. Double thanks to those who endured and stayed to the end. We've learned from this experience and we will do better in future webinars.Read More
Codename One already has two separate socket APIs: a low-level API similar to java.net.Socket and a higher-level event-based approach. So why do we need WebSockets?Read More
This tutorial is starting to get interesting.... In this section we'll go deep into animations, special effects, search styling and extracting contacts. In the previous sections we built the first form of the app, logged in and now we need to show the actual login form. Even more importantly we need to show it with style like this:Read More
In the previous section we went over the login with Google process, in this section we'll go over the login with Facebook. At this time we'll skip the "invite friends" option since that is blog post all on its own and we can just add that functionality to the completed application.Read More
In the second part of this tutorial we will cover the login process for Google and getting a unique id. We'll try to write generic code that we can later reuse for the Facebook login process. But first lets cover what "signing in" actually means...Read More
In this tutorial we will cover the basics of building a good looking chat application with Codename One that will work on all mobile OS's. We will cover everything from design to social network login and the actual chat behavior.
This project is created with the new Java 8 support to make the code simple and short. This tutorial is for a hand coded application mostly because GUI builder tutorials require video and are thus less searchable.
So you have finished your app and tested it on the simulator. Everything looks good. You're now ready to proceed with testing on your iPhone. You select the "Send iOS Debug Build" menu item and wait for the build server to work its magic, but then you're faced with a notice that iOS builds require a valid certificate and provisioning profile. What a hassle!Read More
When we introduced Codename One initially we limited the API to CLDC level which is roughly a subset of Java 1.3, we then added support for a subset of Java 5 and we are now adding Java 8 language features!
Thanks to some work from Steve and the great work done by the guys from the Retro Lambda project we were able to add compatibility to the major Java 8 features, most notably lambda expressions. This is highly experimental and some features might not work but so far it seems things are functioning rather smoothly.
Facebook & Google login have been a source of a bit of pain mostly because of the obtuse and confusing documentation from both companies. Chen spent some time writing up tutorials for both Facebook Login & Google Login that should help you get started with applications that use such login options.Read More
Notice that the synchronous build feature is an enterprise only feature since its overuse can have a very heavy toll on our servers.
Our build servers are really fast, even if your laptop is relatively slow our iOS build servers are powerful machines equipped with fast SSD's and they generate a full clean build of a typical app (with screenshots etc.) in a couple of minutes!
So the real source of delay when building an app is size, it both slows the build but most of all it slows your upload process (upload is typically much slower than download). Reducing the size of your app will make it faster in runtime as well, e.g. if you have too many redundant resources you might be running into too many GC cycles slowing down execution. In this post we provide some tips to shrink your app size.
Steve wrote a rather detailed appendix to the developer guide covering all of those options from startup splash screen configuration to servlet proxy logic. The build also generates a ready to deploy WAR file which should make setting this up on any Java servlet container a nobrainer.Read More
We are rebuilding the developer guide using JBake and asciidoc which means the guide would be better integrated into the website thus providing more accessible hyperlinkable information. This is already making its way into the site and into the PDF so we'd appreciate feedback.Read More
Sending a push notification from the simulator or mobile device is pretty trivial when we use the
Push class. However, sending push messages from the server seems to be a bit more complicated for most developers since its not as well documented. The main point of complexity is that we didn't provide any samples of server push code and from the fact that the server expects arguments as POST.
This code should work for Java desktop and server side to perform a simple push, notice that the complexity is mostly related to JavaSE's lack of simplified POST arguments.
When Codename One packages applications into native apps we hide a lot of details to make the process simpler. One of the things we had an issue with is
getResource/getResourceAsStream both of which are problematic since they support hierarchies and a concept of package relativity.
That's a concept that is problematic in iOS, generally everything about file access within the bundle in iOS is a bit problematic to accomplish in a cross platform way because Apple tries so hard to "simplify" and ends up creating fragmentation for us.
Up until recently we had to handcode validation logic into every form, this becomes tedious as we work thru larger applications. Some developers built their own generic logic, which leads to obvious duplication of effort. In the interest of keeping everything together we decided to release a standardized validation framework that allows us to define constraints on a set of components, mark invalid entries and disable submission buttons.Read More
Using Codename One's new graphics pipeline it is now possible to start playing with other cool visualization technologies like GeoJSON.Read More
Codename One provides a rich set of drawing primitives in its Graphics class. It allows you to draw text, shapes, and images to the screen. The position where these elements will be rendered is determined based on a combination of Graphics state information (e.g. the current translation, and transform) and coordinates that are passed to the drawing method. Understanding how these coordinates are calculated can be tricky when you first begin using the API.Read More
We just released a new online course on Udemy called "Learn Mobile Programming By Example With Codename One". Before a single day went by we already have over 600 students enrolled which is pretty cool. This course is based on the videos we made for the Dr. Sbaitso demo and the PropertyCross demo with some additional videos thrown in to tie everything together and introduce Codename One.Read More
The new property cross demo shows off the usage of webservices, JSON parsing, infinite scroll, URLImage and lots of other Codename One features. It uses a UK webservice that allows listing properties for sale in the UK.Read More