Android Local Notification Ane


I tried to make “Push Notification” ANE on the Android platform but when the code was executed nothing happened even though when I made ANE there were no errors. I think the java code to bring up notifications that are made wrong. Anyone can help me?

this is the repository that I made: PushNotification Ane!

I test the application on Android 7.
The caller code that I use:

var notif:LocalNotificationExtension = new LocalNotificationExtension();;


com.indramahkota.ane.Toast com.indramahkota.ane.LocalNotification com.distriqt.androidsupport.V4


You need a bit more than just an ANE to make push notification works

see Google Cloud Messaging documentation from distriqt ANE-PushNotifications

but I think you are misunderstanding what push notifications mean

when I see your quick example

var notif:LocalNotificationExtension = new LocalNotificationExtension();;

It does not work like that

“push notifications”, in general, is a server sending a message to your android/ios app (technically it could also be a desktop app), your app is basically “waiting” to receive that message.

It combines server push and notification

see Google Cloud Messaging: Lifecycle Flow

  • Send a message. The app server sends messages to the client app:
    1. The app server sends a message to GCM connection servers.
    2. The GCM connection server enqueues and stores the message if the device is offline.
    3. When the device is online, the GCM connection server sends the message to the device.
    4. On the device, the client app receives the message according to the platform-specific implementation. See your platform-specific documentation for details.
  • Receive a message. A client app receives a message from a GCM connection server. See your platform-specific documentation for details on how a client app in that environment processes the messages it receives.

and that’s about the same principle for all notification service

  • Apple Push Notification Service (APNs)
  • Amazon Simple Notification Service (SNS)
  • Android Cloud to Device Messaging (C2DM)
  • Boomerang Software Framework
  • Blackboard Connect
  • Firebase Cloud Messaging (FCM)
  • Google Cloud Messaging (GCM)
  • Message queuing service
  • SQL Server Notification Services
  • Windows Push Notification Service (WNS)

and there are more like: OneSignal, Microsoft Azure Notification Hub, etc.

it is a bit hard to help you like that without more informations
just the source code of the ANE is not enough

specifically for GCM on Android you need to do many things

  • creating a Google API project
  • enable the GCM service
  • add many things in the manifest of the android app
  • etc.

and you don’t say if you have done those things


Alternatively you can also try to use another open source ANE

either compile it / reuse it
or at least compare their code and setup to what you do in your code

Another one (but much older)

you can find the original blog post here
as3c2dm – AIR native extension to push notifications with C2DM (web archive)


I just want to make “Local Notification” @ zwetan. I think the concept of “FCM / GCM” is not related here. I also tried creating a pure Android application and there was no problem with displaying local notifications.


OK I get it but the title of the ANE got me carried away on classic “push notifications”

I think your problem is how you define SendNotification as a inner class

you do this

public class NotificationExtensionContext extends FREContext {

    public Map<String, FREFunction> getFunctions() {
        Map<String, FREFunction> map = new HashMap<>();
        map.put(SEND_NOTIFICATION, new SendNotification());
        return map;

    public class SendNotification implements FREFunction {
        public FREObject call(FREContext context, FREObject[] args) {

when you should do this (eg. no inner class, directly call the method)

public class NotificationExtensionContext extends FREContext implements FREFunction {

    public Map<String, FREFunction> getFunctions() {
        Map<String, FREFunction> map = new HashMap<>();
        map.put(SEND_NOTIFICATION, this );
        return map;

    public FREObject call(FREContext ctx, FREObject[] args) {


(or do the classic way of defining functions as separate classes)

also why don’t you use logging and logcat?


import android.util.Log;

// ...

Log.d( TAG, ""my log message" );
  • be sure you have USB debugging enabled
  • go into the AIR SDK Android binaries
    eg. $ cd /sdk/AIR/31_0/lib/android/bin
  • run adb with logcat


show debug level message
$ ./adb -d logcat

filter for the android app “”
use priority level from Verbose to SIlent
$ ./adb logcat *:S

only print message with the string “I air”
$ ./adb logcat | grep "I air"

my preferred being, use 2 terminal
first one run $ ./adb logcat to see everything, on your app “” get the process id
second one run $ ./adb logcat -v threadtime | grep 12345 (replace 12345 with the process id)

that way you can see all the logs and traces associated with the app


Ok thanks for helping @zwetan, i will try it. Hopefully it can work as I expected.


I get an error in logcat:

10-10 13:36:24.944 30318 30318 W System.err: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(pri=0 contentView=null vibrate=null sound=default defaults=0x1 flags=0x10 color=0x00000000 vis=PRIVATE)
10-10 13:36:24.944 30318 30318 W System.err: at
10-10 13:36:24.945 30318 30318 W System.err: at
10-10 13:36:24.945 30318 30318 W System.err: at
10-10 13:36:24.945 30318 30318 W System.err: at com.indramahkota.anelocalnotification.NotificationExtensionContext$


Thank you @zwetan, I have been able to display the notification now thanks to logcat knowledge