gdx-notifications

Cross-platform notifications for libgdx

License

License

GroupId

GroupId

games.spooky.gdx
ArtifactId

ArtifactId

gdx-notifications-android
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

aar
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-android

How to add to project

<!-- https://jarcasting.com/artifacts/games.spooky.gdx/gdx-notifications-android/ -->
<dependency>
    <groupId>games.spooky.gdx</groupId>
    <artifactId>gdx-notifications-android</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/games.spooky.gdx/gdx-notifications-android/
implementation 'games.spooky.gdx:gdx-notifications-android:1.0.0'
// https://jarcasting.com/artifacts/games.spooky.gdx/gdx-notifications-android/
implementation ("games.spooky.gdx:gdx-notifications-android:1.0.0")
'games.spooky.gdx:gdx-notifications-android:aar:1.0.0'
<dependency org="games.spooky.gdx" name="gdx-notifications-android" rev="1.0.0">
  <artifact name="gdx-notifications-android" type="aar" />
</dependency>
@Grapes(
@Grab(group='games.spooky.gdx', module='gdx-notifications-android', version='1.0.0')
)
libraryDependencies += "games.spooky.gdx" % "gdx-notifications-android" % "1.0.0"
[games.spooky.gdx/gdx-notifications-android "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
games.spooky.gdx : gdx-notifications jar 1.0.0
com.badlogicgames.gdx : gdx-backend-android jar 1.5.5
androidx.core » core jar 1.3.2

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