public FileDownloadListener(Context context, Connection connection) { this.mConnection = connection; this.mContext = context; recieveFilePath = YiFileUtils.getStorePath() + "yiim/" + UserInfo.getUserInfo(context).getUserName() + "/file_recv/"; // ServiceDiscoveryManager sdm = ServiceDiscoveryManager // .getInstanceFor(connection); // if (sdm == null) // sdm = new ServiceDiscoveryManager(connection); // sdm.addFeature("http://jabber.org/protocol/disco#info"); // sdm.addFeature("jabber:iq:privacy"); FileTransferManager transfer = new FileTransferManager(connection); FileTransferNegotiator.setServiceEnabled(connection, true); transfer.addFileTransferListener(new RecFileTransferListener()); }
/** * Instantiates a new file share system. * * @param deviceID * the device id * @param localCacheDirectory * the local cache directory */ public FileShareSystem(String deviceID, File localCacheDirectory) { this.deviceID = deviceID; fileShareDelegatesByContentID = new HashMap<MD5Hash, FileShareSystemContentRegistrationDelegate>(); this.localFileCache = new LocalFileCache(localCacheDirectory); FileTransferNegotiator.IBB_ONLY = true; fileReceiver = new FileReceiver(this, this.localFileCache); fileTransferManager = new FileTransferManager(SynergyNetCluster.get().getXMPPConnection()); log.fine("Registering fileReceiver with file transfer manager"); fileTransferManager.addFileTransferListener(fileReceiver); messagingManager = SynergyNetCluster.get().getMessagingManager(); messagingManager.registerMessageListener(this, FileDistributionMessage.class); }