Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Monitor Device Battery Status Using Ionic Framework

So you’re making a mobile app using Ionic Framework and you care about the experience your users receive? Maybe you want to control the functionality of certain features based on how much battery the users device has left.

An example of this is, maybe you have your application pulling remote data while the application is open. Maybe you’ve decided that if your users battery is less than 30% you want the user to have to pull-to-refresh in order to preserve battery life.

This kind of battery monitoring can be performed through the cordova-plugin-battery-status plugin by Apache Cordova.

Read More

Extending The Gradle Build File In Apache Cordova 5.0+

Apache Cordova 5.0 brought many changes, all of which are for the best, but many of which are a major inconvenience in terms of development or deployment. For example, previously I wrote about whitelisting external resources in Ionic Framework because by default everything is now blacklisted.

This time we’re going to explore the new default build system, Gradle. This build system is nothing new as I’ve written about it in the past, however, it is new when it comes to Apache Cordova and hybrid mobile application development.

You may run into library conflicts or need to do little customizations to your build process. We’re going to see how to do these things. Gradle is for Android only, so if you’re developing for iOS, feel free to move along.

Read More

From Bitmap To Base64 And Back With Native Android

Working with images in Android is great, but what happens when you need to store them somewhere other than the file system? Let’s say for example you want to store them in a SQLite or NoSQL type database. How would you store such a piece of data?

One common way to store image data would be to first convert the image into a base64 string. We all know strings are very easy to store in some data structure.

Base64 via Wikipedia:

A group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation.

Another way would be to store the binary data in a CLOB or BLOB type SQL column, but to keep it generic, in this particular example, we will be exploring the idea of converting images into base64 strings.

Read More

Make A Gallery-Like Image Grid Using Native Android

Previously I had written an article regarding how to make a gallery-like image grid using Ionic Framework, but what if we wanted to accomplish the same using the native Android SDK?

In this tutorial we’ll see how to make use of the Android GridView with an image adapter to display remote images from the internet.

Read More

Whitelist External Resources For Use In Ionic Framework

It was recently brought to my attention that big things came with the latest Apache Cordova Android and iOS update. One of the major updates being the requirement of whitelisting in order to use external resources.

What exactly does this mean?

Take the example of some random API like Facebook or TinyURL. If you try to perform a request on either of these APIs it will fail because by default everything external is blacklisted. By adding to the whitelist, things change.

Read More

Draw A Graphic To A SurfaceView Using Native Android

There are many ways to create mobile Android games. For example you can use a framework like Unity3D or Unreal Engine, or you can use native APIs like the SurfaceView canvas or OpenGL. All the different methods have their pros and cons.

In this particular example we’re going to see how to render graphics to the Android screen by extending the SurfaceView class and a canvas.

Read More

Create A Minesweeper Game With Native Android

So recently I was presented with a challenge. Make a Minesweeper game using native Android with no additional frameworks such as Unity3D or similar.

Minesweeper via Wikipedia:

A single-player puzzle video game. The objective of the game is to clear a rectangular board containing hidden “mines” without detonating any of them, with help from clues about the number of neighboring mines in each field.

This task can be accomplished many ways. For example we could choose to use OpenGL, a 2D canvas, or something else. In this particular tutorial we’re going to be using a 2D canvas because it is simple and acceptable for a game with minimal to no animations.;

Read More