Task Killer written in Python

This is a discussion on Task Killer written in Python within the Droid Development forums, part of the Droid Hacking category; Just wanted to get some feedback for a task killer I wrote for android in Python. I used the SL4A .apk which you can get ...

+ Reply to Thread
Results 1 to 10 of 10

Thread: Task Killer written in Python

  1. Junior Droid
    brianhellno's Avatar
    Member #
    77260
    Join Date
    Jun 2010
    Posts
    5
    Phone
    Droid
    #1

    Task Killer written in Python

    Just wanted to get some feedback for a task killer I wrote for android in Python. I used the SL4A .apk which you can get from here:

    android-scripting - Project Hosting on Google Code

    Then I installed the Python module which that page will also help you out with.

    If you give it a try let me know if it worked and what you think of it. I'm also interested if anyone has any suggestions to make it better script wise or just in general. To use this script create a new Python script and paste this script into the coding area. On to the code:

    Code:
    import android
    
    droid = android.Android()
    
    a = droid.getRunningPackages()
    
    proclist = a[1]
    
    def taskkiller(proclist): 
       title = 'Running Processes'
       droid.dialogCreateAlert(title)
       droid.dialogSetNeutralButtonText('Kill Process')
       droid.dialogSetMultiChoiceItems(proclist, None)
       droid.dialogShow()
       droid.dialogGetResponse()
       choice = droid.dialogGetSelectedItems().result
       return choice
    
    x = taskkiller(proclist)
    
    for y in x:
       droid.forceStopPackage(proclist[y])
       print '%s was closed' % proclist[y]
    Basically the script gathers all of the currently running processes and creates an alert dialogue. In the dialogue you can select all of the processes that you want to close and the script kills them. Its very simplistic but I like it. To be completely honest I have no coding experience and I pretty much wrote this with trial and error and a lot of reading about Android and Python. Learned a lot in the process though. I'm thinking my next script will be an .apk uninstaller and re-installer. Anyways enjoy.
  2. Sponsor
    DF Advertising
    Join Date
    Nov 2008
    Location
    DroidForums.net
     
     
     
     
  3. Droid Ninja
    aminaked's Avatar
    Member #
    25714
    Join Date
    Jan 2010
    Location
    California, USA
    Posts
    2,187
    Liked
    1 times
    Phone
    Droid
  4. RS/Moderator
    Abe21599's Avatar
    Member #
    18400
    Join Date
    Dec 2009
    Location
    Ohio
    Posts
    6,088
    Liked
    25 times
    Phone
    Galaxy Nexus
    Premium Member
    #3
    Quote Originally Posted by aminaked View Post
    i saw that you responded to this thread and i was like o gosh i know what hes gonna post hahahah
  5. Junior Droid
    brianhellno's Avatar
    Member #
    77260
    Join Date
    Jun 2010
    Posts
    5
    Phone
    Droid
    #4
    Quote Originally Posted by aminaked View Post
    Yeah. I made it more for situations like when an app hangs and the only way to get it unstuck is to force kill it. I usually use it for that and just to see what processes are currently running.
  6. RS/Moderator
    Abe21599's Avatar
    Member #
    18400
    Join Date
    Dec 2009
    Location
    Ohio
    Posts
    6,088
    Liked
    25 times
    Phone
    Galaxy Nexus
    Premium Member
    #5
    Quote Originally Posted by brianhellno View Post
    Quote Originally Posted by aminaked View Post
    Yeah. I made it more for situations like when an app hangs and the only way to get it unstuck is to force kill it. I usually use it for that and just to see what processes are currently running.
    well as long as you understand how android works, do what works for you.

    but just so you know, you can do both of those in settings.

    im not knocking your work, i cant do it, but its already incorporated in android
  7. Junior Droid
    brianhellno's Avatar
    Member #
    77260
    Join Date
    Jun 2010
    Posts
    5
    Phone
    Droid
    #6
    Quote Originally Posted by Abe21599 View Post
    Quote Originally Posted by aminaked View Post
    i saw that you responded to this thread and i was like o gosh i know what hes gonna post hahahah
    Lol yeah I guess this isn't the most useful script. Ah well, the next one will be better.
  8. Droid Ninja
    aminaked's Avatar
    Member #
    25714
    Join Date
    Jan 2010
    Location
    California, USA
    Posts
    2,187
    Liked
    1 times
    Phone
    Droid
    #7
    Quote Originally Posted by Abe21599 View Post
    Quote Originally Posted by aminaked View Post
    i saw that you responded to this thread and i was like o gosh i know what hes gonna post hahahah
    Ha ha ha! Yeah, I'm like a broken record. Don't kill tasks! Don't use the stock email app! Don't use antivirus!

    To the OP, keep crankin' out that code & have fun!
  9. RS/Moderator
    Abe21599's Avatar
    Member #
    18400
    Join Date
    Dec 2009
    Location
    Ohio
    Posts
    6,088
    Liked
    25 times
    Phone
    Galaxy Nexus
    Premium Member
    #8
    Quote Originally Posted by brianhellno View Post
    Quote Originally Posted by Abe21599 View Post
    Quote Originally Posted by aminaked View Post
    i saw that you responded to this thread and i was like o gosh i know what hes gonna post hahahah
    Lol yeah I guess this isn't the most useful script. Ah well, the next one will be better.
    Quote Originally Posted by aminaked View Post
    Quote Originally Posted by Abe21599 View Post
    Quote Originally Posted by aminaked View Post
    i saw that you responded to this thread and i was like o gosh i know what hes gonna post hahahah
    Ha ha ha! Yeah, I'm like a broken record. Don't kill tasks! Don't use the stock email app! Don't use antivirus!

    To the OP, keep crankin' out that code & have fun!
    yes please no discouragement meant here - keep it up
  10. Junior Droid
    brianhellno's Avatar
    Member #
    77260
    Join Date
    Jun 2010
    Posts
    5
    Phone
    Droid
    #9
    Quote Originally Posted by Abe21599 View Post
    Quote Originally Posted by brianhellno View Post
    Quote Originally Posted by aminaked View Post
    Yeah. I made it more for situations like when an app hangs and the only way to get it unstuck is to force kill it. I usually use it for that and just to see what processes are currently running.
    well as long as you understand how android works, do what works for you.

    but just so you know, you can do both of those in settings.

    im not knocking your work, i cant do it, but its already incorporated in android
    Its cool I appreciate that you were up front with me. I mainly wrote the task killer to see if I could do it and thought I'd share in case anyone else was interested and to hopefully get feedback on the code. I'm thinkin my next script will be more useful. I just need to learn how to access the file system from python.
  11. Junior Droid
    brianhellno's Avatar
    Member #
    77260
    Join Date
    Jun 2010
    Posts
    5
    Phone
    Droid
    #10
    Lol thanks for the encouragement. When I'm done with my next script I'll be sure to post it here.

Sponsors

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Similar Threads

  1. SystemPanel: a task killer for people who hate task killers.
    By tliebeck in forum App Announcements
    Replies: 55
    Last Post: 05-05-2011, 03:35 AM
  2. Automatic Task killer, NOT Advanced Task Killer
    By hamitup in forum Droid Applications
    Replies: 15
    Last Post: 06-30-2010, 11:26 PM
  3. Replies: 8
    Last Post: 06-25-2010, 07:28 AM
  4. Task Killer
    By pchakmak in forum Android Forum
    Replies: 11
    Last Post: 03-20-2010, 03:46 PM
  5. Task Management or Task Killer?
    By RSQJEEP in forum Droid Applications
    Replies: 1
    Last Post: 11-24-2009, 08:09 PM

Search tags for this page

android apps written in python

,
android forcestoppackage example
,
android kill process name sl4a
,
developing droid in python
,
dialoggetselecteditems
,
dialogsetmultichoiceitems
,
droid.hangup python
,
forcestoppackage
,
how to kill sl4a python program
,
kill process with python on android
,
python apps for android
,

python droid

,

python droid x

,

python for droid

,

python kill task

,
python sl4a apk
,

sl4a forcestoppackage

,
sl4a kill process
,

sl4a play mp3

,
sl4a to kill android apps
Click on a term to search our site for related topics.

Tags for this Thread