WifiDirectSdHelper.java 文件源码

java
阅读 42 收藏 0 点赞 0 评论 0

项目:dissertation-project 作者:
@Override
public void register(final int port, final boolean discover, Context context) {
    mP2PManager.initialize(context, context.getMainLooper(), new ChannelListener() {

        @Override
        public void onChannelDisconnected() {
            Log.d(TAG, "Channel disconnected...");
        }
    });

    mService.registerReceiver(mWifiReceiver, mWifiIntentFilter);

    final Map<String, String> record = new HashMap<String, String>();
    record.put(TXTRECORD_PORT, String.valueOf(port));

    mServiceInfo = WifiP2pDnsSdServiceInfo.newInstance(SERVICE_INSTANCE, SERVICE_REG_TYPE, record);

    mP2PManager.addLocalService(mChannel, mServiceInfo, mLocalServiceListener);

    if (discover) {
        discover();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号