Start the Service after the phone rebooted

36 views
Skip to first unread message

Vishak Raj

unread,
Dec 23, 2023, 10:04:41 AM12/23/23
to Kivy users support
Hi, I am tring to do start the service even after the phone reboot with help from this blog - https://github.com/kivy/kivy/wiki/Starting-Kivy-App-and-Service-on-bootup-on-Android

the code -

package org.myproject.myapp;

import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.Context;
import org.myproject.myapp.ServiceMyservice;

public class MyBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
String package_root = context.getFilesDir().getAbsolutePath();
String app_root = package_root + "/app";
Intent ix = new Intent(context, ServiceMyservice.class);
ix.putExtra("androidPrivate", package_root);
ix.putExtra("androidArgument", app_root);
ix.putExtra("serviceEntrypoint", "./service/main.py");
ix.putExtra("pythonName", "myservice");
ix.putExtra("pythonHome", app_root);
ix.putExtra("pythonPath", package_root);
ix.putExtra("pythonServiceArgument", app_root+":"+app_root+"/lib");
ix.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startService(ix);
}
}


I tried this code, but the service is not started after the phone restarted,

I dont know about the java much, and I know the kivy basics,

could you help me by explaining what will be these variables and its value - what is the difference between package_root , app_root,

is serviceEntrypoint will be assigned to the service python file?

what is the all ix.putExtra statements explaining, by learning these then only i can understand the flow to make the service start automatically when the phone restarted

Could you please help me to understand, thanks
 

elli...@cox.net

unread,
Dec 23, 2023, 11:53:43 AM12/23/23
to kivy-...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/2ce284f1-6293-4e82-a5b3-c6431ec87bc2n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages