Android編程獲取手機后臺運行服務(wù)的方法
更新時間:2015年12月04日 09:21:54 作者:馬到成功168855
這篇文章主要介紹了Android編程獲取手機后臺運行服務(wù)的方法,涉及Android針對系統(tǒng)服務(wù)的相關(guān)操作技巧,具有一定參考借鑒價值,需要的朋友可以參考下
本文實例講述了Android編程獲取手機后臺運行服務(wù)的方法。分享給大家供大家參考,具體如下:
public static String getRunningServicesInfo(Context context) {
StringBuffer serviceInfo = new StringBuffer();
final ActivityManager activityManager = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningServiceInfo> services = activityManager.getRunningServices(100);
Iterator<RunningServiceInfo> l = services.iterator();
while (l.hasNext()) {
RunningServiceInfo si = (RunningServiceInfo) l.next();
serviceInfo.append("\npid: ").append(si.pid);
serviceInfo.append("\n\nname:").append(si.service);
serviceInfo.append("\n\nprocess: ").append(si.process);
serviceInfo.append("\n\nservice: ").append(si.service);
serviceInfo.append("\n\ncrashCount: ").append(si.crashCount);
serviceInfo.append("\n\nclientCount: ").append(si.clientCount);
/*serviceInfo.append("\nactiveSince: ").append(ToolHelper.formatData(si.activeSince));
serviceInfo.append("\nlastActivityTime: ").append(ToolHelper.formatData(si.lastActivityTime));*/
serviceInfo.append("\n============================");
serviceInfo.append("\n\n\n");
}
return serviceInfo.toString();
}
希望本文所述對大家Android程序設(shè)計有所幫助。
您可能感興趣的文章:
- Android判斷App前臺運行還是后臺運行(運行狀態(tài))
- Android開發(fā)中實現(xiàn)應(yīng)用的前后臺切換效果
- Android中使用Service實現(xiàn)后臺發(fā)送郵件功能實例
- Android后臺定時提醒功能實現(xiàn)
- Android中Service(后臺服務(wù))詳解
- Android后臺線程和UI線程通訊實例
- Android中使用IntentService創(chuàng)建后臺服務(wù)實例
- Android App后臺服務(wù)報告工作狀態(tài)實例
- android教程之使用asynctask在后臺運行耗時任務(wù)
- Android判斷當前應(yīng)用程序處于前臺還是后臺的兩種方法
- Android 后臺發(fā)送郵件示例 (收集應(yīng)用異常信息+Demo代碼)
- Android 進入設(shè)備后臺data文件夾的辦法
- 解析后臺進程對Android性能影響的詳解
- 深入解析Android系統(tǒng)中應(yīng)用程序前后臺切換的實現(xiàn)要點
相關(guān)文章
Android編程錄音工具類RecorderUtil定義與用法示例
這篇文章主要介紹了Android編程錄音工具類RecorderUtil定義與用法,結(jié)合實例形式分析了Android錄音工具類實現(xiàn)開始錄音、停止錄音、取消錄音、獲取錄音信息等相關(guān)操作技巧,需要的朋友可以參考下2018-01-01
Android開發(fā)實現(xiàn)根據(jù)字母快速定位側(cè)邊欄
這篇文章主要為大家詳細介紹了Android開發(fā)實現(xiàn)根據(jù)字母快速定位側(cè)邊欄,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-09-09
Flutter基于Dart Unwrapping Multiple Optional小技巧
這篇文章主要為大家介紹了Flutter Unwrapping Multiple Optional打開多個選項小技巧示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-12-12
Android基于ListView實現(xiàn)類似Market分頁加載效果示例
這篇文章主要介紹了Android基于ListView實現(xiàn)類似Market分頁加載效果,結(jié)合完整實例形式分析了ListView的OnScroll方法來實現(xiàn)分頁與滾動加載的操作步驟與相關(guān)實現(xiàn)技巧,需要的朋友可以參考下2016-10-10

