android.app.Service#getClass ( )源码实例Demo

下面列出了android.app.Service#getClass ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: BigApp_Discuz_Android   文件: ServiceManager.java
public void startService(final Context context, final Service... services) {

        Thread serviceThread = new Thread(new Runnable() {
            @Override
            public void run() {
                for (Service s : services) {

                    if (!ServiceUtils.isServiceRunning(context, s.getClass()
                            .getName())) {

                        Intent i = new Intent(context, s.getClass());
                        context.startService(i);

                        ZogUtils.printLog(ServiceManager.class,
                                "start service " + s.getClass().getName());
                    }

                }
            }
        });
        serviceThread.start();
    }
 
源代码2 项目: springreplugin   文件: PluginServiceClient.java
/**
 * 在插件服务中停止服务。近似于Service.stopSelf
 * 注意:此方法应在插件服务中被调用
 *
 * @param s 要停止的插件服务
 * @see android.app.Service#stopSelf()
 */
public static void stopSelf(Service s) {
    Intent intent = new Intent(s, s.getClass());
    try {
        PluginMgrFacade.stopService(intent);
    } catch (Throwable e) {
        if (LOGR) {
            LogRelease.e(PLUGIN_TAG, "pss.ss: pf f", e);
        }
    }
}
 
源代码3 项目: BigApp_Discuz_Android   文件: ServiceManager.java
public void stopService(final Context context, final Service... services) {
    for (Service s : services) {
        Intent service = new Intent(context, s.getClass());
        context.stopService(service);
    }

}
 
源代码4 项目: BigApp_Discuz_Android   文件: ServiceManager.java
public void restartService(final Context context, final Service... services) {
    System.out.println("ServiceManager restartService");
    stopService(context, services);

    for (Service s : services) {
        Intent service = new Intent(context, s.getClass());
        context.startService(service);
    }

}
 
源代码5 项目: AndroidWear-OpenWear   文件: WatchFaceStyle.java
public Builder(Service service) {
    this(new ComponentName(service, service.getClass()));
}