Git Product home page Git Product logo

tw1ddle / samcodes-notifications Goto Github PK

View Code? Open in Web Editor NEW
23.0 6.0 8.0 2.22 MB

:speech_balloon: Local device notification support for OpenFL Android and iOS targets

Home Page: https://samcodes.co.uk/code/

License: MIT License

Haxe 44.32% Batchfile 0.73% C++ 12.29% Objective-C++ 40.98% Shell 1.68%
local-notifications ios-notifications notification-android haxelib notification notifications haxe haxe-bindings haxe-library

samcodes-notifications's Introduction

Haxe Local Notifications

License

Local notifications support for Haxe OpenFL Android and iOS targets. See the demo here.

Features

  • Schedule, manage and cancel local device notifications.
  • Manage application icon notification badge counts.
  • Open application when notification is tapped.
  • Custom notification icons (on Android only).

If there is something you would like adding let me know. Pull requests welcomed too.

Install

Get the haxelib:

haxelib install samcodes-notifications

Usage

Include the haxelib through Project.xml:

<haxelib name="samcodes-notifications" />

Known Issues

Due to a bug you cannot cancel individual notifications on iOS, though they can be cancelled all together. This means that if you schedule notifications using the same slots, any older untriggered notifications will not be overridden on iOS, but will on Android.

Due to the way Android alarm management works, force-stopping an application always cancels scheduled notifications. Notifications cancelled this way will be rescheduled the next time the device is rebooted, or when the app is relaunched.

Example

See the demo app for a complete example.

Android notifications with badging. Badging is done using ShortcutBadger:

Screenshot of Android notification

Android notification with custom notification icons:

Screenshot of Android notification

iOS notifications and badging:

Screenshot of iOS notification

Notes

This haxelib was originally based on the local notifications extension for Stencyl by byrobingames. Android app icon badging support is provided by ShortcutBadger by Leo Lin, which is licensed under the Apache License, Version 2.0.

Use #if (android || ios) conditionals around your imports and calls to this library for cross platform projects, as there is no stub/fallback implementation included in the haxelib.

If you need to rebuild the iOS or simulator ndlls navigate to /project and run rebuild_ndlls.sh.

samcodes-notifications's People

Contributors

pign avatar tw1ddle avatar wsandwitch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

samcodes-notifications's Issues

is It possible to remove app permissions?

After I added this extension to my game now it is asking for permissions of Phone and Storage. I don't see that this is really needed by the extension but I can't find how to remove them.

Ability to set icons

Could we get the ability to set the icons and not just have the app icon with the info badge? Thanks!

Only first character of (non-ASCII) notification messages appear in demo app

Just noting this in case anyone else runs into this issue. My demo app for the haxelib prints notification messages in a variety of languages, and these messages used to display correctly.

https://github.com/Tw1ddle/samcodes-notifications-demo

Under Haxe 4.1.2 and hxcpp 4.2.1 and OpenFL 9.1.0, the notification message bodies only ever include the first character of the message, "I" (of messages that read like "Id x: non-english-text..."), on iOS.

It seems to work fine for strings that are all in English, but using messages from an array of strings that include other stuff, including non-ASCII characters, does not work.

Perhaps there is a string encoding/conversion issue going over my head: https://github.com/Tw1ddle/samcodes-notifications/blob/master/project/iphone/SamcodesNotifications.mm#L184

Avoid dependencies

is it possible to assemble this lib without dependencies (android-support-v4.jar)?

Problems with ios

Hi, I am using this extension to make notifications in our games, in android work well!, but in ios have the next error:

/Applications/Xcode.app/Contents/Developer/usr/bin/make
Haxe device build: Release-iphoneos-v7
haxe Build.hxml -D HXCPP_ARMV7 -cpp build/Release-iphoneos-v7 
/usr/local/lib/haxe/lib/samcodes-notifications/1,0,1/extension/notifications/Notifications.hx:36: characters 2-35 : Not enough arguments
/usr/local/lib/haxe/lib/samcodes-notifications/1,0,1/extension/notifications/Notifications.hx:44: characters 9-49 : Not enough arguments
/usr/local/lib/haxe/lib/samcodes-notifications/1,0,1/extension/notifications/Notifications.hx:40: lines 40-46 : Missing return Int
make: *** [build-haxe-armv7] Error 1

** BUILD FAILED **

Thanks in advance for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.