本文整理汇总了Java中org.fourthline.cling.android.AndroidUpnpServiceImpl类的典型用法代码示例。如果您正苦于以下问题:Java AndroidUpnpServiceImpl类的具体用法?Java AndroidUpnpServiceImpl怎么用?Java AndroidUpnpServiceImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AndroidUpnpServiceImpl类属于org.fourthline.cling.android包,在下文中一共展示了AndroidUpnpServiceImpl类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStart
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
if(mWearNotificationServiceSenderConnection != null) {
bindService(new Intent(mActivity, AndroidUpnpServiceImpl.class),
mWearNotificationServiceSenderConnection,
Activity.BIND_AUTO_CREATE);
}
if(mHeartRateDataServiceReceiverConnection != null) {
bindService(new Intent(mActivity, AndroidUpnpServiceImpl.class),
mHeartRateDataServiceReceiverConnection,
Activity.BIND_AUTO_CREATE);
}
}
示例2: onCreate
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Fix the logging integration between java.util.logging and Android
// internal logging
org.seamless.util.logging.LoggingUtil.resetRootHandler(new FixedAndroidHandler());
// Now you can enable logging as needed for various categories of Cling:
// Logger.getLogger("org.fourthline.cling").setLevel(Level.FINEST);
listAdapter = new ArrayAdapter<DeviceDisplay>(this, android.R.layout.simple_list_item_1);
setListAdapter(listAdapter);
// This will start the UPnP service if it wasn't already started
getApplicationContext().bindService(new Intent(this, AndroidUpnpServiceImpl.class),
serviceConnection, Context.BIND_AUTO_CREATE);
}
示例3: onCreate
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Fix the logging integration between java.util.logging and Android
// internal logging
LoggingUtil.resetRootHandler(new FixedAndroidHandler());
Logger.getLogger("org.teleal.cling").setLevel(Level.INFO);
setContentView(R.layout.devices);
init();
deviceListRegistryListener = new DeviceListRegistryListener();
getApplicationContext().bindService(
new Intent(this, AndroidUpnpServiceImpl.class),
serviceConnection, Context.BIND_AUTO_CREATE);
}
示例4: onCreate
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDeviceUdn = getArguments().getString(ARGS_UDN);
if (mDeviceUdn == null || mDeviceUdn.isEmpty())
throw new IllegalStateException("FileBrowserFragment requires a Device UDN");
mContainerMap = new HashMap<>();
mContainerMap.put(ContainerWrapper.ROOT_CONTAINER_ID, ContainerWrapper.ROOT_CONTAINER);
mCurrentContainer = ContainerWrapper.ROOT_CONTAINER;
if (getArguments().getString(ARGS_INITIAL_CONTAINER_ID) != null) {
ContainerWrapper wrapper = new ContainerWrapper(
"Bookmark", getArguments().getString(ARGS_INITIAL_CONTAINER_ID), BOOKMARK_PARENT_ID);
mContainerMap.put(wrapper.getId(), wrapper);
mCurrentContainer = wrapper;
}
// TODO(smcgruer): Handle failure gracefully.
if (!getActivity().getApplicationContext().bindService(
new Intent(getActivity(), AndroidUpnpServiceImpl.class),
this,
Context.BIND_AUTO_CREATE)) {
throw new IllegalStateException("Unable to bind AndroidUpnpServiceImpl");
}
}
示例5: onCreate
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO(smcgruer): Handle failure gracefully.
Log.d(TAG, "onCreate: binding service");
if (!getActivity().getApplicationContext().bindService(
new Intent(getActivity(), AndroidUpnpServiceImpl.class),
mServiceConnection,
Context.BIND_AUTO_CREATE)) {
throw new IllegalStateException("Unable to bind AndroidUpnpServiceImpl");
}
}
示例6: onCreate
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
// Make the Cast button show.
// TODO(smcgruer): Determine if there is a more correct way to do this.
CastContext.getSharedInstance(this);
// Bind the UPnP service. This is not actually used in MainActivity, but is used by multiple child fragments.
// Binding it here means that it will not be destroyed and recreated during fragment transitions.
// TODO(smcgruer): Handle failure gracefully.
if (!getApplicationContext().bindService(
new Intent(this, AndroidUpnpServiceImpl.class),
mServiceConnection,
Context.BIND_AUTO_CREATE)) {
throw new IllegalStateException("Unable to bind AndroidUpnpServiceImpl");
}
// Initialize the database connection.
mBookmarksDbHelper = new BookmarksDbHelper(getApplicationContext());
if (mServerBrowserFragment != null)
throw new IllegalStateException("mServerBrowserFragment should be null in onCreate");
mServerBrowserFragment = ServerBrowserFragment.newInstance();
getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container, mServerBrowserFragment)
.commit();
}
示例7: onCreate
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e(TAG, "Activity created.");
setContentView(R.layout.activity_main);
mContext = this;
mToolbar = (Toolbar) findViewById(R.id.main_toolbar);
if (mToolbar != null)
setSupportActionBar(mToolbar);
mViewPager = (ViewPager) findViewById(R.id.main_view_pager);
mPagerAdapter = new ViewPagerAdapter(mContext,
getSupportFragmentManager());
mViewPager.setAdapter(mPagerAdapter);
// 为viewpager设置切换动画
mViewPager.setPageTransformer(true, new DepthPageTransformer());
mNavigation = (DrawerLayout) findViewById(R.id.main_navitagion_layout);
TypedValue typedValue = new TypedValue();
mContext.getTheme().resolveAttribute(R.attr.colorPrimary, typedValue,
true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
mNavigation.setStatusBarBackgroundColor(typedValue.data);
bindService(new Intent(this, AndroidUpnpServiceImpl.class), this,
Context.BIND_AUTO_CREATE);
}
示例8: onCreate
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mSettingsManager = new SettingsManager(getApplicationContext());
if(mSettingsManager.getUpnpServiceEnabled()) {
mHeartRateDataServiceSenderConnection = new HeartRateDataServiceSenderConnection();
mWearNotificationServiceReceiverConnection = new WearNotificationServiceReceiverConnection();
mStartPollServiceSenderConnection = new StartPollServiceSenderConnection();
mWearNotificationServiceReceiverConnection.registerListener(this);
bindService(new Intent(this, AndroidUpnpServiceImpl.class),
mWearNotificationServiceReceiverConnection,
Context.BIND_AUTO_CREATE);
bindService(new Intent(this, AndroidUpnpServiceImpl.class),
mStartPollServiceSenderConnection,
Context.BIND_AUTO_CREATE);
bindService(new Intent(this, AndroidUpnpServiceImpl.class),
mHeartRateDataServiceSenderConnection,
Context.BIND_AUTO_CREATE);
}
}
示例9: onCreate
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mSettingsManager = new SettingsManager(this.getApplicationContext());
if(mWearNotificationServiceSenderConnection != null) {
mWearNotificationServiceSenderConnection.registerListener(this);
bindService(new Intent(this, AndroidUpnpServiceImpl.class), mWearNotificationServiceSenderConnection, BIND_AUTO_CREATE);
}
}
示例10: onCreate
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mStartPollServiceReceiverConnection = new StartPollServiceReceiverConnection();
mStartPollServiceReceiverConnection.registerListener(this);
bindService(new Intent(this, AndroidUpnpServiceImpl.class),
mStartPollServiceReceiverConnection, BIND_AUTO_CREATE);
}
示例11: DLNARouteProvider
import org.fourthline.cling.android.AndroidUpnpServiceImpl; //导入依赖的package包/类
public DLNARouteProvider(Context context) {
super(context);
// Use custom logger
org.eclipse.jetty.util.log.Log.setLog(new JettyAndroidLog());
this.downloadService = (DownloadService) context;
dlnaServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
dlnaService = (AndroidUpnpService) service;
dlnaService.getRegistry().addListener(registryListener = new RegistryListener() {
@Override
public void remoteDeviceDiscoveryStarted(Registry registry, RemoteDevice remoteDevice) {
}
@Override
public void remoteDeviceDiscoveryFailed(Registry registry, RemoteDevice remoteDevice, Exception e) {
// Error is displayed in log anyways under W/trieveRemoteDescriptors
}
@Override
public void remoteDeviceAdded(Registry registry, RemoteDevice remoteDevice) {
deviceAdded(remoteDevice);
}
@Override
public void remoteDeviceUpdated(Registry registry, RemoteDevice remoteDevice) {
deviceAdded(remoteDevice);
}
@Override
public void remoteDeviceRemoved(Registry registry, RemoteDevice remoteDevice) {
deviceRemoved(remoteDevice);
}
@Override
public void localDeviceAdded(Registry registry, LocalDevice localDevice) {
deviceAdded(localDevice);
}
@Override
public void localDeviceRemoved(Registry registry, LocalDevice localDevice) {
deviceRemoved(localDevice);
}
@Override
public void beforeShutdown(Registry registry) {
}
@Override
public void afterShutdown() {
}
});
for (Device<?, ?, ?> device : dlnaService.getControlPoint().getRegistry().getDevices()) {
deviceAdded(device);
}
if(searchOnConnect) {
dlnaService.getControlPoint().search();
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
dlnaService = null;
registryListener = null;
}
};
if(!context.getApplicationContext().bindService(new Intent(context, AndroidUpnpServiceImpl.class), dlnaServiceConnection, Context.BIND_AUTO_CREATE)) {
Log.e(TAG, "Failed to bind to DLNA service");
}
}