> how can I know the service is already started ?
if you have only one service in application,try this,
private void checkservice() {
int chk=0;
List<ActivityManager.RunningServiceInfo> procList =
getRunningAppProcessesList();
if ((procList == null) || (procList.size() == 0)) {
......
}
for (ActivityManager.RunningServiceInfo appProcInfo :
procList) {
if ((appProcInfo != null)){
if(appProcInfo.process.indexOf("your pakage name")!=-1)
chk++;
}
}
if(chk>0) {
.... service is already started
}else{
....
}
}
private List<ActivityManager.RunningServiceInfo>
getRunningAppProcessesList() {
ActivityManager am =
(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
return am.getRunningServices(40);
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe from this group, send email to
android-developers+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.