top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Daemonify my python script on Android

+2 votes
797 views

I want to daemonify my python script on Android device. That is, it should be automatically invoked on boot up.

Appreciate your help.

posted Dec 22, 2013 by Chandra Javalkar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Basically you want to run a script at bootup time. See this thread should help -
http://android.stackexchange.com/questions/6558/how-can-i-run-a-script-on-boot
This is an Android OS matter -- how does anything get started on Android at boot time? Do the same with your Python invocation.

2 Answers

+1 vote

I don't know anything about Android programming, but for Linux following may be helpful:

http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
http://fedoraproject.org/wiki/Packaging:SysVInitScript

May not directly applicable to you, but can help.

answer Dec 23, 2013 by anonymous
+1 vote

Those aren't the same thing. To daemonise a program is independent of whether the program starts automatically; it can start automatically without detaching (e.g. the process that requests a login) it can detach on request without starting automatically (e.g. any daemon started by a user), etc.

If you want the program to start automatically on boot up, that's not a python question; you want to find out about the Android boot process and what facilities it has for starting a program on boot. But that's independent of Python and independent of daemonising the program.

If you want to have a program become a daemon (i.e. a background process) the python-daemon library is designed for this. But that's nothing to do with automatic start-up, nor Android; you're on your own for those.

answer Dec 23, 2013 by anonymous
Similar Questions
+2 votes

I am trying to control Aeroplane mode on Android using Python code. I am running QPyPlus python. When I execute this code(that is widespread in the net),

#!/usr/bin/python 
import android droid = android.Android()
# go to airplane mode
 droid.toggleAirplaneMode()

droid.makeToast('exiting')

I get the error 'no such attribute Android()'.

One important thing is, I want to be able to do this without the need to reboot the Android device and any other working solution is also fine long as it is invokeable through Python.

+1 vote

When I input usb line with my android phone into the pc , there are two disks j: and k: (type :removable disk) displayed in win7.

I can get my android phone bluetooth mac address .

import bluetooth
nearby_devices = bluetooth.discover_devices(lookup_names = True)
for addr, phoneName in nearby_devices:
 print(addr)

it is XX:XX:XX:XX:XX:XX

Now how can I write a file into the disk j: of my android phone(bluetooth mac is XX:XX:XX:XX:XX:XX )?

+2 votes

How we can send mail with attachment in Python? Is it any prerequisite for it?

+2 votes

I want to use the stdout of child process as an input of another thread, but some how I am not able to read the stdout. Using Popen I have created a child process and stdout of it I have redirected to PIPE (because I don't want that to be printed on with my main process). Now using this statement,"Line=Proc.stdout.readline()" I want to read stdout of child process and I have to do operation on that. but somehow i am not able to read from stdout of child process.

Following is the code snapshot -

Proc = Popen(["python.exe","filename.py"],stdout=PIPE)

while True:
            Line = Proc.stdout.readline()
            print Line

Here,
Filename.py(Child process) is continuously printing "Hello World!!" in place of reading stdout of child process.

+2 votes

I'm trying to access Apples iCal-Server on a Mac OS X Snow Leopard Server via Python. The server is up and running and working with it via the iCal-Application is just fine. Now I need to access this server via Python to use it as backend for resource planning.

So how can I read the events within a time range from a user's calendar using python?

...