gdx-notifications

Cross-platform notifications for libgdx

License

License

GroupId

GroupId

games.spooky.gdx
ArtifactId

ArtifactId

gdx-notifications-desktop-os
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

gdx-notifications
Cross-platform notifications for libgdx
Project URL

Project URL

https://github.com/spookygames/gdx-notifications
Project Organization

Project Organization

Spooky Games
Source Code Management

Source Code Management

https://github.com/spookygames/gdx-notifications

Download gdx-notifications-desktop-os

Dependencies

compile (4)

Group / Artifact Type Version
games.spooky.gdx : gdx-notifications jar 1.0.0
com.badlogicgames.gdx : gdx-backend-lwjgl jar 1.5.5
com.badlogicgames.gdx : gdx-platform jar 1.5.5
com.github.wokier : java-to-OS-notify jar 0.6

Project Modules

There are no modules declared in this project.

gdx-notifications

Cross-platform notifications for libgdx.

See here for an example implementation.

Setup

This library needs libgdx starting from version 1.5.5.

Add the pretty bold parts into your build.gradle file:

    allprojects {
        ext {
            gdxNotificationsVersion = '1.0.0'
        }
    }

    ...

    repositories {
        jcenter() Only necessary if you plan to use JCommunique
    }
    
    ...
    
    project(":desktop") {
        
        ...
        
        dependencies {
            compile project(":core")
            ...
            compile "games.spooky.gdx:gdx-notifications-desktop-jcommunique:$gdxNotificationsVersion" for Swing notifications
            OR
            compile "games.spooky.gdx:gdx-notifications-desktop-os:$gdxNotificationsVersion" for native notifications
        }
    }
    
    project(":android") {
        
        ...
        
        dependencies {
            compile project(":core")
            ...
            compile "games.spooky.gdx:gdx-notifications-android:$gdxNotificationsVersion"
        }
    }
    
    project(":html") {
            
        ...
        
        dependencies {
            compile project(":core")
            ...
            
            compile "games.spooky.gdx:gdx-notifications-html-gwt:$gdxNotificationsVersion"
            compile "games.spooky.gdx:gdx-notifications:$gdxNotificationsVersion:sources"
            compile "games.spooky.gdx:gdx-notifications-html-gwt:$gdxNotificationsVersion:sources" for gwt notifications
            OR
            compile "games.spooky.gdx:gdx-notifications-html-browser:$gdxNotificationsVersion"
            compile "games.spooky.gdx:gdx-notifications:$gdxNotificationsVersion:sources"
            compile "games.spooky.gdx:gdx-notifications-html-browser:$gdxNotificationsVersion:sources" for browser notifications
        }
    }
    
    project(":core") {
        
        ...
        
        dependencies {
            ...
            compile "games.spooky.gdx:gdx-notifications:$gdxNotificationsVersion"
        }
    }

Add

<inherits name="games.spooky.gdx.notifications.gdx_notifications_gwt"/>

after

<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt'/>

in your GdxDefinition.gwt.xml.

Usage

Initialization

We're talking platform-specific stuff here, so you'll need to initialize the magic in your specific initializers. Simply follow the indications from libgdx's wiki.

Classes you'll have for this:

  • DesktopNotificationHandler (desktop, whether it's from JCommunique or java-to-OS-notify)
  • AndroidNotificationHandler (warning, notifications are not supported for android versions below 14)
  • HtmlNotificationHandler

And the base interface with two methods:

  • NotificationHandler

Notify

NotificationHandler handler = <your_platform-specific_handler_here>;
handler.showNotification(new NotificationParameters(12, "Notification title for the people", "Text Lorem ipsum"));

Remove notification

NotificationHandler handler = <your_platform-specific_handler_here>;

// You could (should!) very well get the parameters object from above
// But it will go nice too if you create a new object
// Only the id matters actually
handler.hideNotification(new NotificationParameters(12, "", ""));

Platform support

games.spooky.gdx

Spooky Games

Versions

Version
1.0.0
0.1.0