Skip to content

Instantly share code, notes, and snippets.

@Dirk-Sandberg
Last active May 31, 2022 12:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dirk-Sandberg/f82c2dc9a22d588dd0b16c985f7c41fb to your computer and use it in GitHub Desktop.
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
# Files are below, this is just to change the name of the gist
# Most basic example of kv code for push notifications with kivy-ios
Button:
text: "Push notifications demo"
# 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