Developing applications for Raspberry Pi or Linux

Depending on: project’s scope, business expectations, your knowledge and Raspberry Pi’s role you can develop software for RPi in mainly three ways:

  1. Turn Raspberry Pi into API-like webserver with node.js and do all the programming in clients.
  2. Develop a HTML/CSS/JS application
  3. Develop an native Raspberry Pi app

All of the above require you to:

  • Develop a regular Linux app
  • Optimised to use hardware and computing power of Raspberry Pi
  • Run it in Raspbian OS or any other Linux distribution of your choice

And, if you really want to get your hands dirty and truly have no limits then you must forget about Linux and start thinking about Ultibo (there’s a separate article for that).

Developing in Ultibo (or similar complete embedded development environment) requires a lot of expertise, development knowledge and practice. And simply isn’t an option for all. Especially, if you only need to build a quick-and-easy app for RapberryPi. For these purposes this article lists details about RPi development.

Read More “Developing applications for Raspberry Pi or Linux”

PhoneGap Build app and more languages in Windows Marketplace

When preparing an application for publication in Google Play, you can provide description and other details of your application in as many languages as you want, directly in Google Play Developer Console.

You won’t find anything similar in Windows Phone Dev Center. This is, because Windows Marketplace is the only market of “big three” platforms, that require you to declare supported languages inside your application before you’ll be able to create store impression for your application in different languages.

Read More “PhoneGap Build app and more languages in Windows Marketplace”

Quick mobile UI review

Here is a quick review of some mobile UIs that you can use to develop your mobile application, if you’re developing HTML-like mobile apps.

Note that I don’t like jQuery Mobile for being ugly and slow and I don’t like paid full-featured stuff like Sencha or Kendo. You won’t find them here. I like fast and beauty mobile apps (possibly written in PhoneGap).

So you will find performance-first, beauty-second UI frameworks here. With special emphasis on being PhoneGap-oriented. Only quick review without any unnecessary blah-blah.

Read More “Quick mobile UI review”

Is PhoneGap’s applications size a big problem to end users?

Since PhoneGap wraps HTML5 and Javascript code (plus all the stuff) into native app wrapper, then we may assume, that in general PhoneGap-based mobile applications will have significantly higher size in compare to native mobile application. This is true in most scenarios and this leads us to a question, if large mobile application size may be a problem to end user?

By an accident, I run into this question from December 2011 asking, if 4 MB of executable size for mobile devices is too much for a simple application. Even though it is over 3,5 years after asking this question, the general rule remains. I found my answer to this question quite interesting and thus I’m sharing it in here.

Read More “Is PhoneGap’s applications size a big problem to end users?”

Deploying a PhoneGap app to Windows Marketplace

After Deploying a PhoneGap application to iTunes (App Store) and Deploying a PhoneGap app to Google Play articles, here comes the time to deal with Windows Mobile platform and Windows Marketplace. This article should provide you with all the necessary information on how to successfully submit your .xap file (compiled locally or through Phonegap Bulid) to Windows Marketplace.

Read More “Deploying a PhoneGap app to Windows Marketplace”

Remove system menu button from PhoneGap application

By default your PhoneGap application will contain system menu button, even on those systems (Android 4.0+) that doesn’t support this button any more (i.e. applications written for this system should not use this button; it is handled anyway and you can use it, if you really wish to).

On most new devices user pressing this button will be simply ignored by system and nothing will happen. So, this problem reduces itself to purely aesthetic means (whether you care about seeing that unusable button on system bar, when your app is active, or not).

However, there are reports, that PhoneGap applications crashes on small group of devices, when user presses this not handled system menu button. In this case, more radical solutions must be considered.

Read More “Remove system menu button from PhoneGap application”

Deploying a PhoneGap application to iTunes (App Store) [updated]

This article was initially written in June 2015 and generally updated 15 months later so you’ll find information and examples as they were available in mid-August 2016.

This article deals about deploying PhoneGap application to Apple App Store. Question: Is it possible without having a real Mac computer or using Mac-lease-like service? The quick an straight answer is: you can’t do this. It was possible around two years ago, but things has changed and s for now (2015) you must have any of above to submit your application to App Store.

Read More “Deploying a PhoneGap application to iTunes (App Store) [updated]”

AdMob Plugin and pure-Javascript ads in PhoneGap Build application

It all started with this Stack Overflow question asked by me 2,5 year ago, when I was attempting to strike with ads in mobile applications for the first time. I’m still using PhoneGap Build only therefore in the past I was very limited to only these ad networks, that supported displaying their add through pure Javascript only. However, all the things had changed radically, with introduction of npm plugins to PhoneGap Build. You can now use in pure Javascript PhoneGap Build application all the ad networks, that require you to use their native SDKs…

Read More “AdMob Plugin and pure-Javascript ads in PhoneGap Build application”

PhoneGap Audiobook Player. An abandoned project

I’m a an audiobook maniac. Listening to audiobooks requires MP3 player to have a special feature, which remembers last file/track played in a folder and last position within that file, for all folders, not just current one. This allows to listen to many audiobooks simultaneously, just as you’d be making bookmarks to a regular, printed book. All MP3 player, that I tested so far, hasn’t got than feature. Once you switched from folder/book A to folder/book B and then back to A, book/folder A was “reset” and play started from the very beginning. In this situation, I decided to write my own audiobook player in PhoneGap and release it as open source. Pity, but I failed to finish this project. Thus, I’m publishing only an unfinished sources and links to resources.

Read More “PhoneGap Audiobook Player. An abandoned project”

A library for gauges, charts or data visualisation

There are certain drawing and graphic libraries in Javascript that can be considered for:

  • drawing charts,
  • doing some data visualization for the website,
  • using them as gauges / clocks for the mobile client

(gauges can be used in limited manner on the website as well).

This article deals with most interesting ones that you may consider for above purposes.

Read More “A library for gauges, charts or data visualisation”

Add sounds and speach to your website or application

Most websites are developed without sounds and if there are any sounds inside then they’re most likely coming from some videos and they’re not single click-like or notification-like sounds, known very well from desktop applications. The same goes for many mobile application, as sounds are mostly found in mobile games.

But, if you do need something like click sound, tick sound or any notification-like short sound, then this article lists some most famous, yet free sites, from where you can get as many such sounds as you need.

No code here, sorry! Refer to other sources on how to embed sound within website or mobile application.

Read More “Add sounds and speach to your website or application”

Increasing `loadUrlTimeoutValue` to avoid `Connection to server was unsuccessful` error

If your PhoneGap application loads some external content (either local files or any server-side data) using AJAX, keep an eye on the fact, that on very slow mobile devices, it may end up with error message saying, that connection to given URL failed. Which means a typical timeout.

You may experience the very same issue, if you’re building apps in debug mode and debug server (either yours or default weinre one) is down or responds to slowly.

Read More “Increasing `loadUrlTimeoutValue` to avoid `Connection to server was unsuccessful` error”

Doubled canvas drawings on Android with hardware acceleration enabled

There is a bug in HTML 5 Canvas object exposed on Android platforms, in versions 4.1.1 till 4.3 (newest, as of writing it, though not yet fixed). It causes that, when hardware acceleration is turned on, any drawings on canvas will be doubled at top of the page.

At first, I thought, that this is caused only in Segment Display — a fabulous JS library, that I use. This is why, you’ll find a lot of references to it in this article. But then it turned out to be general Android problem, that appears not only in PhoneGap applications (which uses webview), but also in all pages served on Android 4.1.x+ platform.

So, you’ll also find some ideas, how to work around this problem, if you’re not using Segment Display.

Read More “Doubled canvas drawings on Android with hardware acceleration enabled”

PhoneGap apps must use domain whitelisting to access external resources

If your PhoneGap application loads some external content via AJAX, keep in mind that you have to include domain whitelisting in your config.xml.

PhoneGap is very strange about this, from version to version and from platform to platform, and sometimes allows you to access external resources without domain whitelisting (I had that issue, that this worked on Android 2.x, but failed on 4.x). So, to be sure, add it to every new project.

Read More “PhoneGap apps must use domain whitelisting to access external resources”

Detecting if PhoneGap application is run under Ripple Emulator

As of writing this, Ripple Emulator itself is old, long-time not updated. But, what is much more wrong, it has very, very old version of PhoneGap behind. Currently it is based on version 2.0.0, while we already have version 3.0.0 in local PhoneGap building and 2.9.0 in PhoneGap Build. If you compare PhoneGap API reference from version 2.9.0 with the one inside Ripple Emulator, you’ll see that changes are dramatic. That’s why being able to detect, when your application is running in debug mode (i.e. under Ripple Emulator) is essential.

Read More “Detecting if PhoneGap application is run under Ripple Emulator”

Get language name and ISO code based on native language name

For one of my PhoneGap project’s I needed a function that will convert local (native) language name into international (English) language name. And another one that will return correct two-letter language code (ISO 639-1), again, based on native language name. This was required because PhoneGap applications are returning local name for currently selected language (so, you’ll get polski instead of Polish, Tiếng Việt instead of Vietnamese and so on).

Here are these functions for future reference and for others, who could possible find them useful.

Read More “Get language name and ISO code based on native language name”

When you should NOT use jQuery.load in PhoneGap application?

In most more complex PhoneGap applications developers split app contents into several files. When these are truly separate “screen” of application, and are accessible via normal <a href=""> links, everything is fine.

Problems arise, when you want to split contents of one “screen” into several files. For example to have tabs, where each tab content is stored in external separate file. In this case, content is loaded on tab’s tab (or preloaded during application init) using AJAX (which can be used to request local files as well).

If you rely on jQuery and want to use .load() or .ajax() function, read this post to avoid common pitfalls.

Read More “When you should NOT use jQuery.load in PhoneGap application?”

Pause and resume events in PhoneGap application

If you use pause and resume events in your PhoneGap application, keep in mind, that these are fired for every situation, when your application goes to background.

Not only, when user presses Home button, but also when for example a calendar notice popus up.

Turning device screen off and on again also counts as loosing your app to background, so it will also cause PhoneGap to fire pair of pause and resume events.

Using Ripple Emulator for Windows to test PhoneGap applications

Though Ripple Emulator is mainly produced for testing Blackberry applications, you can easily use it for testing PhoneGap apps, build for any platform supported by PhoneGap. But, it is still Blackberry-oriented tool and so it is its documentation, so you may face some missing parts and blackholes, when reading it. Especially, when you’re building your apps in the cloud, using PhoneGap Build.

The aim of this post is to fix as many of these as possible and save you some time.

Read More “Using Ripple Emulator for Windows to test PhoneGap applications”

Some issues about links in PhoneGap applications

It is uncommon and not to often to place external links (leading to an external pages) inside application built with PhoneGap. However, if you decide to do so, read this article to get knowledge about issues you may run into. If you target Android 2.x as well, you’ll also find some interesting information here.

There are generally two things, you should consider about links in PhoneGap applications. One about external links and second about links under overlay.

External links

Links to external pages replaces (covers) entire are of your application and thus made it nearly completely unusable to the user.

If you use direct link (<a href="http://www.acrid.pl/">acrid.pl</a>) and user taps it, contents of destination page (or eventually an error message) will cover entire application area, completely replacing contents of your mobile application. What is more important, device’s back button won’t work in this case, meaning that your application is actually dead upon user taps such link.

There is no going back and leaving app, going to home screen to restart your application again, will restore it from memory in previous state — that is, with external webpage open, not with contents of your application. The only option user have to get back to your application is to force to close it from task manager and hard-restart it. This is not wanted behavior in most situations.

To avoid these problems, always open links to external webpages using specific Javascript code. For example:

window.open(url, '_system', 'location=yes');

Part location=yes is important. Leaving third parameter empty will result in above mentioned behavior.

This code is tested to work in Android. According to PhoneGap documentation and blog, it should work in other platforms as well.

For your own convinience and purity of your code, you should consider enclosing this in a handy function:

function openUrl(url)
{
    window.open(url, '_system', 'location=yes');
}

and call it using either jQuery binding:

$('#btnAcrid').click(function()
{
    openUrl('http://acrid.pl/');
});

or direct linking:

Visit <a href="#" onclick="openUrl('http://acrid.pl/');">this page</a> for more information.

Either way is good and prevents your application from falling into above mentioned problems.

Overlayed links

PhoneGap app under Android 2.x ignores full-page overlays and allows tapping links below it.

If you’re using any Javascript library to replace dully Javascript alert(), confirm() and prompt() functions with cool looking modal dialog boxes — like Twitter Bootstrap, Apprise and many more — keep your eye on some trobules you may run into under Android 2.x.

I tested this issue on two different versions of Android and on two separate mobile devices:

  • GSmart Rola G1317D with Android 2.2.2,
  • LG GT540 with Android 2.3.3 and CyanogenMod.

Under first one, user were able to tap links below full-page overlay, but nothing happened as a result of this.

Under LG GT540 with Android 2.3.3 and CyanogenMod, tapping links below overlay sometimes resulted in opening target link. If such link wasn’t “secured” using method described above, again entire content of mobile application was replaced by external webpage content, making application unusable.

Android 4.x is free of this problem (tested under Samsung Galaxy Nexus with Android 4.2.2). You can’t tap at all anything below full-page overlay.

I wasn’t able to further investigate, whether this problem is caused by PhoneGap, used Javascript library (Bootstrap, Apprise, etc.), Android system or CyanogenMod mode.