当前位置: 首页>>代码示例>>Java>>正文


Java NsdServiceInfo.getServiceName方法代码示例

本文整理汇总了Java中android.net.nsd.NsdServiceInfo.getServiceName方法的典型用法代码示例。如果您正苦于以下问题:Java NsdServiceInfo.getServiceName方法的具体用法?Java NsdServiceInfo.getServiceName怎么用?Java NsdServiceInfo.getServiceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.net.nsd.NsdServiceInfo的用法示例。


在下文中一共展示了NsdServiceInfo.getServiceName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeRegistrationListener

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public void initializeRegistrationListener() {
    mRegistrationListener = new NsdManager.RegistrationListener() {

        @Override
        public void onServiceRegistered(NsdServiceInfo NsdServiceInfo) {
            mServiceName = NsdServiceInfo.getServiceName();
            Log.d(TAG, "Service registered: " + mServiceName);
        }

        @Override
        public void onRegistrationFailed(NsdServiceInfo arg0, int arg1) {
            Log.d(TAG, "Service registration failed: " + arg1);
        }

        @Override
        public void onServiceUnregistered(NsdServiceInfo arg0) {
            Log.d(TAG, "Service unregistered: " + arg0.getServiceName());
        }

        @Override
        public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
            Log.d(TAG, "Service unregistration failed: " + errorCode);
        }

    };
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:27,代码来源:NsdHelper.java

示例2: initializeRegistrationListener

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public void initializeRegistrationListener() {
    mRegistrationListener = new NsdManager.RegistrationListener() {
        @Override
        public void onServiceRegistered(NsdServiceInfo NsdServiceInfo) {
            mServiceName = NsdServiceInfo.getServiceName();
            Log.d(TAG, "Service registered: " + mServiceName);
        }

        @Override
        public void onRegistrationFailed(NsdServiceInfo arg0, int arg1) {
            Log.d(TAG, "Service registration failed: " + arg1);
        }

        @Override
        public void onServiceUnregistered(NsdServiceInfo arg0) {
            Log.d(TAG, "Service unregistered: " + arg0.getServiceName());
        }

        @Override
        public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
            Log.d(TAG, "Service unregistration failed: " + errorCode);
        }
    };
}
 
开发者ID:MycroftAI,项目名称:Mycroft-Android,代码行数:25,代码来源:NetworkAutoDiscoveryUtil.java

示例3: toJSON

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
@TargetApi(16)
public static JSONObject toJSON(final NsdServiceInfo serviceInfo) throws JSONException {
    JSONObject obj = new JSONObject();

    InetAddress host = serviceInfo.getHost();
    if (host != null) {
        obj.put("host", host.getHostName());
    }

    int port = serviceInfo.getPort();
    if (port != 0) {
        obj.put("port", port);
    }

    String serviceName = serviceInfo.getServiceName();
    if (serviceName != null) {
        obj.put("serviceName", serviceName);
    }

    String serviceType = serviceInfo.getServiceType();
    if (serviceType != null) {
        obj.put("serviceType", serviceType);
    }

    return obj;
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:27,代码来源:MulticastDNSManager.java

示例4: initializeRegistrationListener

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public void initializeRegistrationListener() {
    mRegistrationListener = new NsdManager.RegistrationListener() {

        @Override
        public void onServiceRegistered(NsdServiceInfo NsdServiceInfo) {
            mServiceName = NsdServiceInfo.getServiceName();
        }

        @Override
        public void onRegistrationFailed(NsdServiceInfo arg0, int arg1) {
        }

        @Override
        public void onServiceUnregistered(NsdServiceInfo arg0) {
        }

        @Override
        public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
        }

    };
}
 
开发者ID:alseambusher,项目名称:QuickFoods-android,代码行数:23,代码来源:NsdHelper.java

示例5: initializeRegistrationListener

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
private void initializeRegistrationListener() {
    mRegistrationListener = new NsdManager.RegistrationListener() {

        @Override
        public void onServiceRegistered(NsdServiceInfo NsdServiceInfo) {
            // Save the service name.  Android may have changed it in order to
            // resolve a conflict, so update the name you initially requested
            // with the name Android actually used.
            mServiceName = NsdServiceInfo.getServiceName();
        }

        @Override
        public void onRegistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
            // Registration failed!  Put debugging code here to determine why.
        }

        @Override
        public void onServiceUnregistered(NsdServiceInfo arg0) {
            // Service has been unregistered.  This only happens when you call
            // NsdManager.unregisterService() and pass in this listener.
        }

        @Override
        public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
            // Unregistration failed.  Put debugging code here to determine why.
        }
    };
}
 
开发者ID:n8fr8,项目名称:LittleBitLouder,代码行数:29,代码来源:NSDSender.java

示例6: initializeRegistrationListener

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public void initializeRegistrationListener() {
    mRegistrationListener = new NsdManager.RegistrationListener() {
        @Override
        public void onServiceRegistered(NsdServiceInfo NsdServiceInfo) {
            mServiceName = NsdServiceInfo.getServiceName();
            Log.d(TAG, "Service registered: " + NsdServiceInfo);
            callCallback(CallbackTypeEnum.ServiceRegistered);
        }

        @Override
        public void onRegistrationFailed(NsdServiceInfo arg0, int arg1) {
            Log.d(TAG, "Service registration failed: " + arg1);
            callCallback(CallbackTypeEnum.RegistrationFailed);
        }

        @Override
        public void onServiceUnregistered(NsdServiceInfo arg0) {
            Log.d(TAG, "Service unregistered: " + arg0.getServiceName());
            callCallback(CallbackTypeEnum.ServiceUnregistered);
        }

        @Override
        public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
            Log.d(TAG, "Service unregistration failed: " + errorCode);
            callCallback(CallbackTypeEnum.UnregistrationFailed);
        }
    };
}
 
开发者ID:ekalyvio,项目名称:CowBit,代码行数:29,代码来源:NsdHelper.java

示例7: initializeRegistrationListener

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public void initializeRegistrationListener() {
    mRegistrationListener = new NsdManager.RegistrationListener() {

        @Override
        public void onServiceRegistered(NsdServiceInfo NsdServiceInfo) {
            mServiceName = NsdServiceInfo.getServiceName();
            flag = true;
            Log.d(TAG, "Service registered: " + mServiceName);
            Toast.makeText(mContext, "Service registered: " + mServiceName, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onRegistrationFailed(NsdServiceInfo arg0, int arg1) {
            Log.d(TAG, "Service registration failed: " + arg1);
            Toast.makeText(mContext,"Service registration failed: " + arg1, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onServiceUnregistered(NsdServiceInfo arg0) {
            Log.d(TAG, "Service unregistered: " + arg0.getServiceName());
            Toast.makeText(mContext, "Service unregistered: " + arg0.getServiceName(), Toast.LENGTH_SHORT).show();
            flag = false;
        }

        @Override
        public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
            Log.d(TAG, "Service unregistration failed: " + errorCode);
            Toast.makeText(mContext, "Service unregistration failed: " + errorCode, Toast.LENGTH_SHORT).show();
        }

    };
}
 
开发者ID:suchoX,项目名称:Simplify,代码行数:33,代码来源:NsdHelper.java

示例8: NsdService

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public NsdService(NsdServiceInfo nsdServiceInfo) {
    this.name = nsdServiceInfo.getServiceName();
    this.type = nsdServiceInfo.getServiceType();
    this.hostIp = nsdServiceInfo.getHost() == null ? null : nsdServiceInfo.getHost().getHostAddress();
    this.hostName = nsdServiceInfo.getHost() == null ? null : nsdServiceInfo.getHost().getHostName();
    this.port = nsdServiceInfo.getPort();
    this.host = nsdServiceInfo.getHost();
}
 
开发者ID:rafakob,项目名称:NsdHelper,代码行数:9,代码来源:NsdService.java

示例9: onServiceFound

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
@Override
public void onServiceFound(final NsdServiceInfo serviceInfo) {
    Log.d(TAG, "onServiceFound() serviceInfo = [" + serviceInfo + "]");
    synchronized (DiscoverResolver.this) {
        if (mStarted) {
            String name = serviceInfo.getServiceName() + "." + serviceInfo.getServiceType() + "local";
            mDebouncer.put(name, DUMMY);
        }
    }
}
 
开发者ID:youviewtv,项目名称:tinydnssd,代码行数:11,代码来源:DiscoverResolver.java

示例10: onServiceLost

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
@Override
public void onServiceLost(final NsdServiceInfo serviceInfo) {
    Log.d(TAG, "onServiceLost() serviceInfo = [" + serviceInfo + "]");
    synchronized (DiscoverResolver.this) {
        if (mStarted) {
            String name = serviceInfo.getServiceName() + "." + serviceInfo.getServiceType() + "local";
            mDebouncer.put(name, null);
        }
    }
}
 
开发者ID:youviewtv,项目名称:tinydnssd,代码行数:11,代码来源:DiscoverResolver.java

示例11: initializeRegistrationListener

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public void initializeRegistrationListener() {
    mRegistrationListener = new NsdManager.RegistrationListener() {

        public void onServiceRegistered(NsdServiceInfo NsdServiceInfo) {
            mServiceName = NsdServiceInfo.getServiceName();
            Toast.makeText(mContext, "Service registered: "+mServiceName,Toast.LENGTH_SHORT).show();
            Log.d(TAG,"Service registered: "+mServiceName);
            setRegistered(true);
        }
        
        public void onRegistrationFailed(NsdServiceInfo arg0, int arg1) {
        	Toast.makeText(mContext, "Service registration failed",Toast.LENGTH_SHORT).show();
        	Log.e(TAG,"Service registration failed");
        }

        public void onServiceUnregistered(NsdServiceInfo arg0) {
        	Toast.makeText(mContext, "Service unregistered",Toast.LENGTH_SHORT).show();
        	Log.d(TAG,"Service unregistered");
        	setRegistered(false);
        }
        
        public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
        	Toast.makeText(mContext, "Service registration failed",Toast.LENGTH_SHORT).show();
        	Log.e(TAG,"Service registration failed");
        }
        
    };
}
 
开发者ID:ArianJM,项目名称:you2peer,代码行数:29,代码来源:NsdHelper.java

示例12: initializeRegistrationListener

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public void initializeRegistrationListener()
{
    mRegistrationListener = new NsdManager.RegistrationListener()
    {

        @Override
        public void onServiceRegistered(NsdServiceInfo NsdServiceInfo)
        {
            mServiceName = NsdServiceInfo.getServiceName();
        }

        @Override
        public void onRegistrationFailed(NsdServiceInfo arg0, int arg1)
        {
        }

        @Override
        public void onServiceUnregistered(NsdServiceInfo arg0)
        {
        }

        @Override
        public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode)
        {
        }

    };
}
 
开发者ID:gaozh1986,项目名称:NsdChat,代码行数:29,代码来源:NsdHelper.java

示例13: initializeRegistrationListener

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public void initializeRegistrationListener() 
{
    mRegistrationListener = new NsdManager.RegistrationListener() 
    {

        @Override
        public void onServiceRegistered(NsdServiceInfo NsdServiceInfo) 
        {
        	Log.d(TAG, "ON NSD SERVICE REGISTERED");
            // Save the service name.  Android may have changed it in order to
            // resolve a conflict, so update the name you initially requested
            // with the name Android actually used.
            mServiceName = NsdServiceInfo.getServiceName();
        }

        @Override
        public void onRegistrationFailed(NsdServiceInfo serviceInfo, int errorCode) 
        {
               Log.e(TAG, "onRegistrationFailed...");
            // Registration failed!  Put debugging code here to determine why.
        }

        @Override
        public void onServiceUnregistered(NsdServiceInfo arg0) 
        {
            // Service has been unregistered.  This only happens when you call
            // NsdManager.unregisterService() and pass in this listener.
        }

        @Override
        public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode) 
        {
            // Unregistration failed.  Put debugging code here to determine why.
        }
    };
}
 
开发者ID:TVLuke,项目名称:DynamixBridge,代码行数:37,代码来源:DiscoveryService.java

示例14: DVBHost

import android.net.nsd.NsdServiceInfo; //导入方法依赖的package包/类
public DVBHost(NsdServiceInfo nsd) {
    this.Name = nsd.getServiceName();
    this.Ip = nsd.getHost().getHostAddress();
    this.Port = String.valueOf(nsd.getPort());
}
 
开发者ID:bennir,项目名称:DVBViewerRemote,代码行数:6,代码来源:DVBHost.java


注:本文中的android.net.nsd.NsdServiceInfo.getServiceName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。