Work on service class

This commit is contained in:
Mark Qvist 2022-09-28 13:12:14 +02:00
parent 80b8ca06c2
commit b60cde6e4f
3 changed files with 16 additions and 2 deletions

View File

@ -145,6 +145,7 @@ public class PythonService extends Service implements Runnable {
builder.setContentText("Reticulum Running"); builder.setContentText("Reticulum Running");
builder.setContentIntent(pIntent); builder.setContentIntent(pIntent);
// TODO: Generalise this
Bitmap icon_bitmap = BitmapFactory.decodeFile("/data/user/0/io.unsigned.sideband/files/app/assets/notification_icon.png"); Bitmap icon_bitmap = BitmapFactory.decodeFile("/data/user/0/io.unsigned.sideband/files/app/assets/notification_icon.png");
Icon service_icon = Icon.createWithBitmap(icon_bitmap); Icon service_icon = Icon.createWithBitmap(icon_bitmap);
// builder.setSmallIcon(context.getApplicationInfo().icon); // builder.setSmallIcon(context.getApplicationInfo().icon);

View File

@ -6,6 +6,20 @@ from jnius import autoclass, cast
Context = autoclass('android.content.Context') Context = autoclass('android.content.Context')
class RnsService():
def __init__(self):
pass
def start(self):
pass
def stop(self):
pass
def restart(self):
self.stop()
self.start()
class sidebandservice(): class sidebandservice():
def __init__(self): def __init__(self):

View File

@ -707,7 +707,6 @@ class SidebandCore():
def __start_jobs_immediate(self): def __start_jobs_immediate(self):
# TODO: Reset loglevel # TODO: Reset loglevel
self.reticulum = RNS.Reticulum(configdir=self.rns_configdir, loglevel=7) self.reticulum = RNS.Reticulum(configdir=self.rns_configdir, loglevel=7)
RNS.log("Reticulum started, activating LXMF...")
if RNS.vendor.platformutils.get_platform() == "android": if RNS.vendor.platformutils.get_platform() == "android":
if not self.reticulum.is_connected_to_shared_instance: if not self.reticulum.is_connected_to_shared_instance:
@ -818,7 +817,7 @@ class SidebandCore():
RNS.log("Error while adding I2P Interface. The contained exception was: "+str(e)) RNS.log("Error while adding I2P Interface. The contained exception was: "+str(e))
self.interface_i2p = None self.interface_i2p = None
RNS.log("Reticulum started, activating LXMF...")
self.message_router = LXMF.LXMRouter(identity = self.identity, storagepath = self.lxmf_storage, autopeer = True) self.message_router = LXMF.LXMRouter(identity = self.identity, storagepath = self.lxmf_storage, autopeer = True)
self.message_router.register_delivery_callback(self.lxmf_delivery) self.message_router.register_delivery_callback(self.lxmf_delivery)