[GUIDE] Apex Launcher Notifications API

Search This thread

dennisxl

Senior Member
Mar 30, 2010
268
2,682
www.anddoes.com
Apex Launcher now offers a public API that lets any application display notification badges on specific icons on the home screen. This is a useful developer feature that allows integration from other applications. For instance, any third-party Email app may notify users of the number of unread emails in Apex Launcher.

To use the API, the Apex Launcher app must be at version 1.3.2 or higher. This feature only works in the pro version and the user needs to enable external notifiers in advanced settings.

Preparation

To use the notifications API, your application must request the proper permission, com.anddoes.launcher.permission.UPDATE_COUNT. Please request this permission in your AndroidManifest.xml file by declaring a <uses-permission> element as a child of <manifest>, as follows:

HTML:
<uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT" />

Updating Notification Counts

Whenever your app needs to update the notification count, send a broadcast intent to Apex Launcher with the following information:

  • The COUNTER_CHANGED action;
  • Target component (package and class names) identifying the icon where the notification badge appears;
  • The unread count for the notification.

Here’s an example:

Code:
    final String ACTION_COUNTER_CHANGED = "com.anddoes.launcher.COUNTER_CHANGED";
    final String EXTRA_NOTIFY_PACKAGE = "package";
    final String EXTRA_NOTIFY_CLASS = "class";
    final String EXTRA_NOTIFY_COUNT = "count";

    final String packageName = getPackageName();
    final String className = packageName + ".MainActivity";

    Intent intent = new Intent(ACTION_COUNTER_CHANGED);
    intent.putExtra(EXTRA_NOTIFY_PACKAGE, packageName);
    intent.putExtra(EXTRA_NOTIFY_CLASS, className);
    intent.putExtra(EXTRA_NOTIFY_COUNT, getCount());
    sendBroadcast(intent);

Generally, there are two situations in which you want to update Apex Launcher with notifications. First, you may push new data to Apex when something changed in your application. For example, you can increase the unread count with the above broadcast intent when there is an incoming email. Second, Apex Launcher may request updates from your application upon certain events. For example, when Apex is started, it needs to poll the latest data from your application. To respond to such requests, you need to include a broadcast receiver in your application.

Responding to Update Requests

When Apex Launcher needs to request data from external notifiers, it sends a broadcast with the UPDATE_COUNTER action. To respond to such requests, you may declare a broadcast receiver like this in your manifest file:

HTML:
<receiver android:name=".UpdateCountReceiver">
    <intent-filter>
        <action android:name="com.anddoes.launcher.UPDATE_COUNTER" />
    </intent-filter>
</receiver>

When you receive this intent in your broadcast receiver, just use the code in the previous section to notify Apex of the latest data.

Code:
    final String ACTION_UPDATE_COUNTER = "com.anddoes.launcher.UPDATE_COUNTER";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent != null && ACTION_UPDATE_COUNTER.equals(intent.getAction())) {
            // update Apex with latest data
            update();
        }
        return;
    }

Sample App

You can find a sample app that makes use of the new API here. Please add the app icon to your desktop to see the notification badge.

I hope you find this API useful and I'm looking forward to seeing some nice app integration with Apex Launcher.
 

lost_

Senior Member
Jan 29, 2010
951
491
DC
Slightly off-topic... would be nice if Apex Pro can provide configurable badge colors. Holo Plus provides background, ring, and text color options.

Also, as some users don't ever use certain features, extra features like the notifier could be shipped out as plugins to keep the core Apex quick and slim.
 

dennisxl

Senior Member
Mar 30, 2010
268
2,682
www.anddoes.com
Slightly off-topic... would be nice if Apex Pro can provide configurable badge colors. Holo Plus provides background, ring, and text color options.

Also, as some users don't ever use certain features, extra features like the notifier could be shipped out as plugins to keep the core Apex quick and slim.

Apex already supports badge style customizations through themes. Here's a link to the theme tutorial.

Yes, it is possible to ship the notifiers as a separate plugin app, both to keep the core app slim and to better manage permissions. However, some people actually prefer to have the functionality built-in so they do not have to install another app. It's a trade-off.
 

itzik2sh

Senior Member
Sep 5, 2011
1,518
712
Can Apex launcher support GO notification EX app or offer an alternative ?
I know a few people that stay on the GO launcher and not move to Apex launcher, just because of this feature...
 

trollsperm

Senior Member
Mar 3, 2011
91
18
I'm not a developer, but would this API allow for a Tasker-plugin to display any numerical Tasker-variable as the "unread" count on any dock icon? Or is it limited to that each app can only display "their own" count; i.e., the K9-devs would need to include this in order to get unread count on a K9 dock icon?
 

dennisxl

Senior Member
Mar 30, 2010
268
2,682
www.anddoes.com
I'm not a developer, but would this API allow for a Tasker-plugin to display any numerical Tasker-variable as the "unread" count on any dock icon? Or is it limited to that each app can only display "their own" count; i.e., the K9-devs would need to include this in order to get unread count on a K9 dock icon?

Since there is no generic way to retrieve unread counts from different apps, each app developer need to use this API to display the count on the desired app icon.
 

The_MutenRoshi

Senior Member
Sep 19, 2011
188
13
Faro
I have the pro version and everthing well done on settings, I have the sms and phone notification icon working, but on Gmail that I installed from play store ( not from Gaaps or built in phone, had to install it) the notification is not working... I have unread mails and do not show up...

anyone knows why?
 

koko115

Senior Member
Jul 1, 2012
1,830
333
For me to. I have pro apex, and notify dont show on stock email on galaxy s3, please tell me why ?
 

dennisxl

Senior Member
Mar 30, 2010
268
2,682
www.anddoes.com
Of corse i install this, and dont show notifi on stock app email icon.

Can you check three things?
1. Did you see unread count on the Email icon in the TouchWiz Launcher?
2. Is the Email app selected if you go to Notification settings in Apex Launcher?
3. Did you use the "Samsung Email" or "Email" in Apex Notifier? If one does not work, have you tried the other?

BTW, this is not the right thread for this discussion. There is a dedicated Apex Notifier thread here on XDA.
 

koko115

Senior Member
Jul 1, 2012
1,830
333
I dont see unread messages on touchwiz on stock email icon. Any idea ?


Edit. Work good. I use "email". On "samsung email" is not work. Werrry thx.
 
Last edited:

koko115

Senior Member
Jul 1, 2012
1,830
333
Hello one more time. Work great only 1-2 houers, after this notifi dont visible. I must go to settings notifications and click to email two times, and agree to widgets then works.
 

ravencroft

Member
May 23, 2009
10
0
I buy the latest version of apex launcher and download apex notifier. They shows all notifications on the desktop icons of all the applications supported and selected, except the mail app that comes installed in my Razr i xt890. The mail app is selected in apex, but the notifier says is not supported. :(
Sorry for my crappy english...
 

powerpoint45

Senior Member
Jan 31, 2012
2,465
2,290
Dallas
Does Apex notifyer send out a broadcast or is it only the external apps that do it. Does Apex Notifyer send out a broadcast that can be used by any external app. Is that how it notifies Apex Launcher? What I am wondering is if I could use this app to use as notification framework for a Launcher I am building or does it strictly send data to Apex Launcher? I tried the broadcast receiver posted but it does not seem like Apex Notified sends out those broadcasts for use in any app. Any suggestions?
 

dennisxl

Senior Member
Mar 30, 2010
268
2,682
www.anddoes.com
Does Apex notifyer send out a broadcast or is it only the external apps that do it. Does Apex Notifyer send out a broadcast that can be used by any external app. Is that how it notifies Apex Launcher? What I am wondering is if I could use this app to use as notification framework for a Launcher I am building or does it strictly send data to Apex Launcher? I tried the broadcast receiver posted but it does not seem like Apex Notified sends out those broadcasts for use in any app. Any suggestions?

The Notifications API described here is intended for other apps to place badges on their app icons. Apex Notifier does not send any broadcast about badge counts. Instead, Apex Launcher binds to a service exported by Apex Notifier to get unread information (similar to how DashClock API works).
 

powerpoint45

Senior Member
Jan 31, 2012
2,465
2,290
Dallas
The Notifications API described here is intended for other apps to place badges on their app icons. Apex Notifier does not send any broadcast about badge counts. Instead, Apex Launcher binds to a service exported by Apex Notifier to get unread information (similar to how DashClock API works).

Thanks for the info. I guess I will have to write my own notifier app then.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    Apex Launcher now offers a public API that lets any application display notification badges on specific icons on the home screen. This is a useful developer feature that allows integration from other applications. For instance, any third-party Email app may notify users of the number of unread emails in Apex Launcher.

    To use the API, the Apex Launcher app must be at version 1.3.2 or higher. This feature only works in the pro version and the user needs to enable external notifiers in advanced settings.

    Preparation

    To use the notifications API, your application must request the proper permission, com.anddoes.launcher.permission.UPDATE_COUNT. Please request this permission in your AndroidManifest.xml file by declaring a <uses-permission> element as a child of <manifest>, as follows:

    HTML:
    <uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT" />

    Updating Notification Counts

    Whenever your app needs to update the notification count, send a broadcast intent to Apex Launcher with the following information:

    • The COUNTER_CHANGED action;
    • Target component (package and class names) identifying the icon where the notification badge appears;
    • The unread count for the notification.

    Here’s an example:

    Code:
        final String ACTION_COUNTER_CHANGED = "com.anddoes.launcher.COUNTER_CHANGED";
        final String EXTRA_NOTIFY_PACKAGE = "package";
        final String EXTRA_NOTIFY_CLASS = "class";
        final String EXTRA_NOTIFY_COUNT = "count";
    
        final String packageName = getPackageName();
        final String className = packageName + ".MainActivity";
    
        Intent intent = new Intent(ACTION_COUNTER_CHANGED);
        intent.putExtra(EXTRA_NOTIFY_PACKAGE, packageName);
        intent.putExtra(EXTRA_NOTIFY_CLASS, className);
        intent.putExtra(EXTRA_NOTIFY_COUNT, getCount());
        sendBroadcast(intent);

    Generally, there are two situations in which you want to update Apex Launcher with notifications. First, you may push new data to Apex when something changed in your application. For example, you can increase the unread count with the above broadcast intent when there is an incoming email. Second, Apex Launcher may request updates from your application upon certain events. For example, when Apex is started, it needs to poll the latest data from your application. To respond to such requests, you need to include a broadcast receiver in your application.

    Responding to Update Requests

    When Apex Launcher needs to request data from external notifiers, it sends a broadcast with the UPDATE_COUNTER action. To respond to such requests, you may declare a broadcast receiver like this in your manifest file:

    HTML:
    <receiver android:name=".UpdateCountReceiver">
        <intent-filter>
            <action android:name="com.anddoes.launcher.UPDATE_COUNTER" />
        </intent-filter>
    </receiver>

    When you receive this intent in your broadcast receiver, just use the code in the previous section to notify Apex of the latest data.

    Code:
        final String ACTION_UPDATE_COUNTER = "com.anddoes.launcher.UPDATE_COUNTER";
    
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent != null && ACTION_UPDATE_COUNTER.equals(intent.getAction())) {
                // update Apex with latest data
                update();
            }
            return;
        }

    Sample App

    You can find a sample app that makes use of the new API here. Please add the app icon to your desktop to see the notification badge.

    I hope you find this API useful and I'm looking forward to seeing some nice app integration with Apex Launcher.
    2
    Slightly off-topic... would be nice if Apex Pro can provide configurable badge colors. Holo Plus provides background, ring, and text color options.

    Also, as some users don't ever use certain features, extra features like the notifier could be shipped out as plugins to keep the core Apex quick and slim.

    Apex already supports badge style customizations through themes. Here's a link to the theme tutorial.

    Yes, it is possible to ship the notifiers as a separate plugin app, both to keep the core app slim and to better manage permissions. However, some people actually prefer to have the functionality built-in so they do not have to install another app. It's a trade-off.