UnBind Particular Service that is binded with Same Service Connection instance (connection)

17 Views Asked by At

Is there Any possiblity to unbind the particular BoundedService from ServiceConnection with same instance for both..Any Help would be appreciated.

  public static ServiceConnection connection = new ServiceConnection() {
    @Override
    public void onServiceConnected(ComponentName className, IBinder service) {
        
        if (className.getClassName().contains("LoggingService")) {
            LoggingService.LogBinder binder = (LoggingService.LogBinder) service;
            myLogService = binder.getService();
            myLogService.LoggingMethod("serviceconnection");
            isBoundLog = true;
        }

        if (className.getClassName().contains("DownloadService")) {
            DownloadService.DownloadBinder binder = (DownloadService.DownloadBinder) service;
            myDwnloadServ = binder.getService();
            isBoundDownload = true;
        }

    }

    @Override
    public void onServiceDisconnected(ComponentName className) {
        if (className.getClassName().contains("LoggingService")) {
            isBoundLog = false;
        }
        if (className.getClassName().contains("DownloadService")) {
            isBoundDownload = false;
        }
      
    }
};
0

There are 0 best solutions below