Add button in my push notification using pyjnius

Viewed 30

I'm trying to create an android app that can create a push notification with a button. I'm using python and kivy.

Follows my currently code:

import kivy
from jnius import autoclass

AndroidString = autoclass('java.lang.String')
PythonActivity = autoclass('org.kivy.android.PythonActivity')
NotificationBuilder = autoclass('android.app.Notification$Builder')
Drawable = autoclass('android.R$drawable')
icon = Drawable.stat_notify_sync
noti = NotificationBuilder(PythonActivity.mActivity)
noti.setContentTitle(AndroidString('title'.encode('utf-8')))
noti.setContentText(AndroidString('message'.encode('utf-8')))
noti.setSmallIcon(icon)
noti.setAutoCancel(True) 
nm = PythonActivity.mActivity.getSystemService(PythonActivity.NOTIFICATION_SERVICE)
nm.notify(0,noti.build())
    

From here what should I do to add a clickable button to my notification?

0 Answers
Related