lundi 29 juin 2015

android test case. how to get the services running?

I have a test case in which i am starting a service by clicking a button. After this i want to verify if it has started or not. how can i do this?

private boolean isMyServiceRunning(Class<?> serviceClass) {
        ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
            String serv = service.service.getClassName();
        }
        return false;
    }

i used this in my test cases but getSystemServices() is not recognized?

Aucun commentaire:

Enregistrer un commentaire