Showing posts with label notifications. Show all posts
Showing posts with label notifications. Show all posts

Tuesday, November 18, 2014

Programming the Apple Watch

Apple has just released Xcode 6.2 (beta) that supports the creation of apps for the Apple Watch. If you have always wanted to dabble in wearable programming, this is a great chance to get involved. The IOS302 - Advanced iOS - Apple Watch Programming is a one-day course that teaches developers how to develop Apple Watch applications.

Topics Covered

• Building Watch Apps
    o How Watch apps work
    o Watch apps lifecycle
    o Sharing data with your iOS app
    o Building the interface of your Watch apps
    o Using the various navigation models for your UI
• Creating Glances
    o What is a glance?
    o Managing the glance interface
• Creating Notifications
    o Notifications interfaces
    o Custom notification interfaces
    o Adding action buttons to notifications
    o Responding to actions

This course includes a Apple Watch (to be delivered when Apple releases the Apple Watch in early 2015)

Prerequisites: You need to be familiar with iOS programming before attending this course. To get started with iOS programming, you are recommended attend the following courses:
• IOS102 - Learn Swift Programming
• IOS101 - Foundation of iPhone Programming

Course Fee
S$1,297 (nett; no GST)

Dates
• 23 Dec 2014
• 27 Feb 2015
• 11 Mar 2015

Venue
Bayview Hotel
SINGAPORE

Sunday, November 09, 2014

Fundamentals of Android Programming - 26-30 Jan 2015 (OSLO, NORWAY)

In collaboration with ProgramUtvikling, I will be teaching the Fundamentals of Android Programming course on the 26 - 30 Jan 2015 in Oslo, Norway. This is a 5-day course that teaches the fundamentals of Android programming, such as Activities, Intents, Broadcast and Broadcast Receivers, Networking, Notifications (local and remote), Data Storage, and more. If you and your team are interest to get into Android development, this course provides the most cost effective way to get started!


What's more, this course will be taught using Google's latest IDE - Android Studio. For this course, you will get a lab-intensive workbook that illustrates the many important concepts of building an Android app.

Monday, September 29, 2014

iOS 8 - Displaying Local Notifications

Displaying local notifications has changed a little in iOS 8. You now need to seek the user's permission in order to display notifications. You can do so via the AppDelegate, like this:

    func application(application: UIApplication, 
    didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        
        application.registerUserNotificationSettings(
            UIUserNotificationSettings(
                forTypes:
                UIUserNotificationType.Sound |
                UIUserNotificationType.Alert |
                UIUserNotificationType.Badge, categories: nil))
            
        return true

    }


Once user's permission is granted, you would now be able to display a notification as usual:

        var localNotification =  UILocalNotification()
        //---the message to display for the alert---
        localNotification.alertBody =
            "You have entered the region you are monitoring"
        
        //---uses the default sound---
        localNotification.soundName = UILocalNotificationDefaultSoundName
        
        //---title for the button to display---
        localNotification.alertAction = "Details"
        
        //---display the notification---

        UIApplication.sharedApplication().presentLocalNotificationNow(localNotification)

Tuesday, August 05, 2014

AND304 - Android Wear Programming


Come and learn how to write native apps for your Android Wear devices! In this course, you will not only learn how to write Android apps to send notifications to your Android Wear watch, but you will also learn how to write native apps that run on the watch itself. 

What's more, every participant will be issued an Android Wear device!

Venue
Bayview Hotel

Fee
S$1,495 (nett; no GST)
* Includes lunch and 2 tea-breaks
* Includes an Android Wear device

Date
18-19 Sep 2014 (Thu-Fri)

Time
9am to 5pm

Prerequisites
Basic knowledge of Android Programming

Course Outline and Application Form
Download here.

Monday, July 07, 2014

AND304 - Android Wear Programming

2014 is undoubtedly the year of the wearables! With the recent announcement of the Android Wear by Google, you are going to see a proliferation of smart watches that allows you to interact with your smartphones without needing to touch it.


In this 2-day course, you will gain a head start in Android Wear programming, and be one of the first to support Android Wear in your Android applications.

Venue
Bayview Hotel

Fee
S$1,495 (nett; no GST)
* Includes lunch and 2 tea-breaks
* Includes an Android Wear device

Date
18-19 Sep 2014 (Thu-Fri)

Time
9am to 5pm

Prerequisites
Basic knowledge of Android Programming

Course Outline and Application Form
Download here.

Sunday, March 30, 2014

Android Tip - Notification Listener Service

Android 4.3 introduces a new API called the Notification Listener Service.  Its main function is to let applications have the ability to be notified when notifications are posted or removed from the system. A good example use of this is the Android Wear application, which receives all the notifications posted on your Android device and routes them to your Android Wear device.

To create a notification, you can use the NotificationCompat.Builder class:

    //---create a notification---
    Notification notification = new
        NotificationCompat.Builder(this)   
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle("Notification Title")
            .setContentText("Notification Message")
            .setTicker("Ticker Text")
            .setAutoCancel(true)       
            .setNumber(1)
            .build();
       
    //---set the sound and lights---
    notification.defaults |=
        Notification.DEFAULT_SOUND;
    notification.defaults |=
        Notification.DEFAULT_LIGHTS;

To post a notification on your Android device, you can use the NotificationManager class’s notify() method, passing it a tag, notification ID, as well as the Notification object:
       
    NotificationManager notificationManager;  
    int notificationID = 0;

    //---display the notification---
    notificationManager.notify("tag",
        notificationID++, notification);   

To listen for notifications posted on the Android device, you need to create a new class that extends the NotificationListenerService base class:

package net.learn2develop.notificationservice;

import
    android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;

public class NotificationListener extends
    NotificationListenerService {

    @Override
    public void onNotificationPosted(
        StatusBarNotification sbn) {
        //---show current notification---
        Log.i("","---Current Notification---");
        Log.i("","ID :" + sbn.getId() + "\t" +
            sbn.getNotification().tickerText + "\t" +
            sbn.getPackageName());
        Log.i("","--------------------------");

        //---show all active notifications---
        Log.i("","===All Notifications===");
        for (StatusBarNotification notif :
            this.getActiveNotifications()) {           
            Log.i("","ID :" + notif.getId() + "\t" +
                notif.getNotification().tickerText + "\t" +
                notif.getPackageName());
        }
        Log.i("","=======================");       
    }

    @Override
    public void onNotificationRemoved(
        StatusBarNotification sbn) {
        Log.i("","---Notification Removed---");
        Log.i("","ID :" + sbn.getId() + "\t" +
            sbn.getNotification().tickerText + "\t" +
            sbn.getPackageName());
        Log.i("","--------------------------");
       
    }   
}

You need to override two methods in this class:
·       onNotificationPosted() – called when a notification is received by the system
·       onNotificationRemoved() – called when a notification is removed

For these two methods, an instance of the StatusBarNotification class will be passed in, allowing you to know which application posted the notification, its content, id, etc.

Within the service, you can also list all the notifications currently available in the notification bar by using the getActiveNotifications() method. You can also remove a particular notification by using the cancelNotification() method, passing it the package name of the application that posted the notification, the tag of the notification, as well as its notification id:

    this.cancelNotification(
        notif.getPackageName(),
        notif.getTag(),
        notif.getId());

To remove all notifications, use the cancelAllNotifications() method:

    //---remove all notifications---       
    this.cancelAllNotifications();

Finally, you need to declare your service in the AndroidManifest.xml file:

<service android:name=".NotificationListener"
    android:label="@string/app_name"
    android:permission=        
    "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
    <intent-filter>
        <action android:name=
 "android.service.notification.NotificationListenerService" />
    </intent-filter>
</service>

When the application is installed on the device, the user must explicitly give permission to your app to listen for notifications on the system. They need to do so via the Notification access page at: Settings | Security | Notification access:


Wednesday, March 26, 2014

Comparing Pebble and Android Wear

A number of readers have wrote in to ask me how does Android Wear compare to Pebble. Here is a list of items that I have compiled which I hope would be useful for those of you wanting to choose a wearable platform to develop for.

Note that this is a work-in-progress and I welcome your feedbacks if any of the items listed here is inaccurate. I will update it as more information is made available. 



Android Wear




Pebble








Android Wear is a modified version of the Android OS adapted for wearable devices sich as watches. The primary function of Android Wear is as an extension of your Android device – displaying notifications and allowing users to interact with the device through voice navigation on the wearable device.

The Pebble is a smart watch that allows you to write apps that run on the watch as well as on your mobile device. It displays notifications from your device.

Pebble also allows companion apps running on the mobile devices to provide additional functionalities to the apps running on the Pebble watch.
  
Availability
Devices such as Moto 360 and LG G watches have been announced; availability not known yet
Pebble and Pebble Steel
Manufacturer support
Motorola, LG, Asus, HTC, Samsung, and more
Pebble
Interaction with users
Voice control and touch screen
Four buttons – Up, Select, Down, and Back
Device Network connectivity
Classic Bluetooth, Bluetooth Low Energy (LE)
Classic Bluetooth, Bluetooth Low Energy (LE)
Hardware Features
Not clear at this moment
Accelerometer, ambient light sensor, magnetometer
Standalone apps
Not available in the Developer Preview release
Yes, watchface apps and watch apps can run standalone on the watch
Companion apps on the mobile device
Android Wear devices require apps on the mobile device to send notifications to it
Companion apps on the mobile device can send notifications as well as provide additional functionalities such as Web services access, location-based services, etc
Connection to mobile device
Requires connection to a Android device
Optional; connection to a mobile device is only required for the installation of watchfaces and watch apps;
Color Screen
Yes
No, only black and white support
Touch Screen
Yes
No
Platform support
Android only
iOS and Android
Supports notifications
Yes. The primarily function of Android Wear is to display notifications from the Android device
Yes. Displays notifications from the iOS and Android device
SDK
Android Wear Developer Preview + Android SDK
Pebble SDK
Programming language support
Java
C (native apps), Javascript, Objective C and Java (Pebble Mobile apps)
Smartphone compatibility
Works with Android 4.3 and above devices. At this moment, Android Wear can only connect to phone devices; but Google has announced that the Android Wear Developer Preview release will be updated to support non-phone devices as well
Works with iOS 6.0 and newer and Android 4.0 and newer devices