I'm looking for a way to schedule local notifications on Android devices. I don't believe there's a function in Ren'Py that can do this, but I figured out how to do it in Android Studio. However, I need to trigger a function in Android Studio from my code in Ren'Py.
I see the vibrate() and openURL() functions being called in PythonSDLActivity.java and using variables set in Ren'Py, so I would like to create my own function that can push variables to Java. In my attempts so far, I can change the vibrate function in Java to push a generic notification, but nothing happens when I make a new function or make changes the to vibrate function in Ren'Py (exports.py).
Can anyone help me with this? Thanks in advance!
[SOLVED] How do I make Ren'Py call a function in PythonSDLActivity.java? (Android)
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- storykween
- Regular
- Posts: 154
- Joined: Mon Sep 30, 2013 1:17 pm
- Completed: Serafina's Saga, Quantum Conscience, Echoes of the Fey, miraclr - Divine Dating Sim
- Organization: Woodsy Studio
- Location: St Louis
- Contact:
[SOLVED] How do I make Ren'Py call a function in PythonSDLActivity.java? (Android)
Last edited by storykween on Thu Jul 27, 2017 4:58 pm, edited 1 time in total.
My website: woodsy-studio.com
- PyTom
- Ren'Py Creator
- Posts: 16093
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: How do I make Ren'Py call a function in PythonSDLActivity.java? (Android)
You want to use pyjnius.
https://github.com/kivy/pyjnius
https://github.com/kivy/pyjnius
Code: Select all
init python:
import jnius
PythonSDLActivity = jnius.autoclass("org.renpy.android.PythonSDLActivity")
python:
PythonSDLActivity.myStaticMethod(1, 2, "Flan")
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
- storykween
- Regular
- Posts: 154
- Joined: Mon Sep 30, 2013 1:17 pm
- Completed: Serafina's Saga, Quantum Conscience, Echoes of the Fey, miraclr - Divine Dating Sim
- Organization: Woodsy Studio
- Location: St Louis
- Contact:
Re: How do I make Ren'Py call a function in PythonSDLActivity.java? (Android)
Awesome, we got that to work! Thanks so much!
My website: woodsy-studio.com
Who is online
Users browsing this forum: Majestic-12 [Bot]