Last active
May 31, 2022 12:23
-
-
Save Dirk-Sandberg/f82c2dc9a22d588dd0b16c985f7c41fb to your computer and use it in GitHub Desktop.
Most basic example of code needed for push notifications with kivy-ios
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Files are below, this is just to change the name of the gist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Most basic example of kv code for push notifications with kivy-ios | |
Button: | |
text: "Push notifications demo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Most basic example of python code for push notifications with kivy-ios | |
from kivy.app import App | |
from kivy.clock import Clock | |
from kivy.utils import platform | |
if platform == 'ios': | |
from pyobjus import autoclass, objc_dict | |
class MainApp(App): | |
def build(self): | |
if platform == 'ios': | |
Clock.schedule_once(self.finish_ios_init) | |
def finish_ios_init(self, *args): | |
self.onesignal_object = autoclass("OneSignal") | |
mock_launch_options = objc_dict({}) | |
self.onesignal_object.initWithLaunchOptions_appId_(mock_launch_options, "your-app-id-here") | |
MainApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment