MService

A sample app on Android Services demonstrating use of both background service and foreground service

Check out services for more.

Credits: The Android  TM Developer’s Cookbook, Second Edition

Check it out at https://github.com/PaulMuriithi/MService

Notification-Light

This is pretty simple

Start off with an instance of NotificationManager, one of the core system services:

NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

Construct a new Notification object:

Notification notification = new Notification();
notification.ledARGB = color;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.ledOnMS = 100;
notnotificationif.ledOffMS = 100;

ledARGB is used to specify an alpha, red, green and blue color value combined into one single integer.

flags has the FLAG_SHOW_LIGHTS flag added to it via a bitwise operation. It simply indicates that you want to make use of a device’s LED in this notification object.

ledOnMS and ledOffMS: The LED will flash with ledOnMS denoting how long the LED will be on and ledOffMS indicating how long it should stay off between flashes.

Lastly call notify

notificationManager.notify(LED_NOTIFICATION_ID,notification);

See https://github.com/PaulMuriithi/Notification-Light for an example

NativeScript-Build truly native apps with JavaScript

The other day I came across the NativeScript framework.

NativeScript enables developers to build native apps for iOS, Android and Windows Universal while sharing the application code across the platforms. When building the application UI, developers use our libraries, which abstract the differences between the native platforms.

I have tried out and it’s quite nice.

Check out this

Charts in Android

Today I was checking out how to make charts in Android.I stumbled upon two good libraries:

MPAndroidChart

A simple charting library for Android, supporting line-, bar-, scatter-, candlestick- and piecharts, as well as scaling, dragging, selecting and animations. Supporting Android 2.2 (API level 8) and upwards.

and

HelloCharts

Charting library for Android compatible with API 8+(Android 2.2). Works best when hardware acceleration is available, so API 14+(Android 4.0) is recommended. Apache License 2.0.

They are quite nice and easy to integrate in ones app.

Material design

I am learning and converting my Android apps to be fully material.

Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. Android now includes support for material design apps. To use material design in your Android apps, follow the guidelines defined in the material design specification and use the new components and functionality available in Android 5.0 (API level 21) and above.

Android provides the following elements for you to build material design apps:

  • A new theme
  • New widgets for complex views
  • New APIs for custom shadows and animations

Happy coding!