当前位置: 首页 > news >正文

佛山营销型网站建设怎么登录百度app

佛山营销型网站建设,怎么登录百度app,厦门seo网站优化,万建站南昌目录 一、前提 1. unity打包android后&#xff0c;链接USB摄像头&#xff0c;需要USB权限。 二、流程 1.Unity导出android工程&#xff0c;Player配置如图&#xff1a; 2.导出android工程 3.在android工程中找到AndroidManifest.xml加入usb权限相关 <?xml version&quo…

目录


一、前提

1. unity打包android后,链接USB摄像头,需要USB权限。

二、流程

1.Unity导出android工程,Player配置如图:

2.导出android工程

3.在android工程中找到AndroidManifest.xml加入usb权限相关

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"><application android:extractNativeLibs="true"><activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@style/UnityThemeSelector" android:screenOrientation="fullSensor" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:resizeableActivity="false" android:hardwareAccelerated="false"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" />//此处<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /></intent-filter><meta-data android:name="unityplayer.UnityActivity" android:value="true" /><meta-data android:name="android.notch_support" android:value="true" /></activity><meta-data android:name="unity.splash-mode" android:value="0" /><meta-data android:name="unity.splash-enable" android:value="True" /><meta-data android:name="unity.launch-fullscreen" android:value="True" /><meta-data android:name="unity.allow-resizable-window" android:value="False" /><meta-data android:name="notch.config" android:value="portrait|landscape" /></application><uses-feature android:glEsVersion="0x00020000" /><uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.CAMERA" />//此处<uses-feature android:name="android.hardware.usb.host" />//此处<uses-permission android:name="android.permission.USB_PERMISSION" /><uses-feature android:name="android.hardware.camera" android:required="false" /><uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /><uses-feature android:name="android.hardware.camera.front" android:required="false" /><uses-feature android:name="android.hardware.touchscreen" android:required="false" /><uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" /><uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>

备注主要三行如下:

<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
<uses-feature android:name="android.hardware.usb.host" />
<uses-permission android:name="android.permission.USB_PERMISSION" />

4.找到UnityPlayerActivity.java,在unity启动onResume方法里面新增打开USB权限设置:

private static final String TAG = "unity";private static final String ACTION_USB_PERMISSION = "com.android.usb.USB_PERMISSION";private UsbManager usbManager;private UsbDeviceConnection connection;private PendingIntent permissionIntent;private boolean permissionGranted = false;private BroadcastReceiver usbReceiver = new BroadcastReceiver() {@Overridepublic void onReceive(Context context, Intent intent) {String action = intent.getAction();Log.d(TAG, "USB设备连接有变化,链接到:"+action);if (ACTION_USB_PERMISSION.equals(action)) {synchronized (this) {unregisterReceiver(usbReceiver);UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {if (usbDevice != null) {// 用户已授权访问USB设备connectUsbDevice(usbDevice);}} else {Log.d(TAG, "用户未授权访问USB设备");
//                        requestPermission(usbDevice);}}}}};// Resume Unity@Override protected void onResume(){super.onResume();if (MultiWindowSupport.getAllowResizableWindow(this))return;mUnityPlayer.resume();openUsbDevice();}private  void openUsbDevice(){//        //获取注册usbusbManager = (UsbManager) getSystemService(Context.USB_SERVICE);IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);// 获取已连接的USB设备列表HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList();Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();if (deviceIterator.hasNext()) {UsbDevice  device = deviceIterator.next();permissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED);filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);Log.e(TAG, "getDeviceList: " + device.getVendorId()+"=="+device.getProductId());///注册广播registerReceiver(usbReceiver, filter);usbManager.requestPermission(device, permissionIntent);} else {Log.d(TAG, "没有找到已连接的USB设备");Toast.makeText(this, "没有找到已连接的USB设备", Toast.LENGTH_SHORT).show();}}private void connectUsbDevice(UsbDevice usbDevice) {if (usbDevice == null) {return;}connection = usbManager.openDevice(usbDevice);if (connection != null) {// 在此处执行USB通信操作Log.d(TAG, "USB设备已连接");Toast.makeText(this, "USB设备已连接", Toast.LENGTH_SHORT).show();} else {Log.d(TAG, "无法打开USB设备连接");Toast.makeText(this, "无法打开USB设备连接", Toast.LENGTH_SHORT).show();}}

注意:应用需要打开摄像机权限

http://www.hkea.cn/news/163975/

相关文章:

  • 美国做按摩广告的网站网站优化教程
  • wordpress云建站教程信息流广告公司一级代理
  • 我有一个域名怎么做网站百度一下下载
  • 郑州网站建设品牌好安装百度到桌面
  • 株洲做网站定制百度灰色词优化排名
  • 上海网页设计公司兴田德润电话排名优化外包公司
  • 做360网站优化快推广普通话宣传语手抄报
  • 动态网站开发语言有哪些大学生创新创业大赛
  • 关键词推广公司网站网络排名优化方法
  • 福州移动网站建设网络营销推广工具有哪些
  • win2008sr怎么用iis做网站国外网站加速
  • 合肥++网站建设磐石网站seo
  • 万网主机怎么上传网站如何在百度上投放广告
  • 做网站时如何给文字做超链接全球疫情最新数据消息
  • 四川省住建厅官方网站3分钟搞定网站seo优化外链建设
  • 做网站阳泉巨量千川广告投放平台
  • 温岭哪里有做网站的如何自制网站
  • 知道创于 wordpress搜索引擎优化宝典
  • 乌兰县wap网站建设公司有效获客的六大渠道
  • 微信网站开发教程视频教程百度一下主页官网
  • 网站开发专业前景关键词挖掘排名
  • 网站开发属于什么职位类别seo查询站长工具
  • wordpress postmetaseoul national university
  • 商务网站的主要存在形式杭州百度快照优化公司
  • 个人备案网站做购物网站可以不班级优化大师免费下载电脑版
  • 贸易网站建设互联网广告代理加盟
  • 深圳网站建设网络公司河北关键词排名推广
  • 在工商网上怎么注册公司seo优化博客
  • 免费的小程序怎么赚钱历下区百度seo
  • 河北石家庄最新疫情最新消息优化防疫政策