开发者

Check if the user is logged into google talk

for my app I need to know whether the user is currently logged into google talk (which ships with most androids). AccountManager does not seem to help..

Someone know/has an idea how to accomplish this?

Th开发者_如何学JAVAank you for answering


You'd Something like this should work:

boolean isGoogleTalkRunning(){
    ActivityManager actManager = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
    List<ActivityManager.RunningTaskInfo> runningServices = am.getRunningServices(some arbitrarily large number);
    //Search through list looking for GTalk service.
}

Note that you'll need to add the GET_TASKS permission in your Manifest. I'm not sure about the actual name of the gtalk service though. I was having trouble finding that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜