本文整理汇总了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);
}
};
}
示例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);
}
};
}
示例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;
}
示例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) {
}
};
}
示例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.
}
};
}
示例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);
}
};
}
示例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();
}
};
}
示例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();
}
示例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);
}
}
}
示例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);
}
}
}
示例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");
}
};
}
示例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)
{
}
};
}
示例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.
}
};
}
示例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());
}