Hi,

I just started writing an application for android and have run into a
wall. I would like my program to wait a certain amount of time and
then stop all currently running services. This would be useful when
falling asleep and you want to listen to music for say 30 minutes and
then the music player turns off automatically. I have tried this bit
of code:

                ActivityManager am = (ActivityManager)
context.getSystemService(Context.ACTIVITY_SERVICE);

                List<ActivityManager.RunningServiceInfo> myList =
am.getRunningServices(20);

                for(int i=0; i < myList.size(); i++){

                        //Toast.makeText(context, myList.get(i).process,
Toast.LENGTH_LONG).show();
                        android.os.Process.killProcess(myList.get(i).pid);
                 }

However, this does not work. Does anyone have a better way to do this
or any suggestions? Thanks,

-Nick

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to