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

手机游戏网站建设应用下载app排行榜

手机游戏网站建设,应用下载app排行榜,广东广东深圳网站建设,深圳市网站制作最好的公司最近搞了个uni小项目,一个定制的小平板,带一个nfc设备,厂家只给了一套安卓原生demo,头一次玩原生安卓,废了好半天劲打出来arr包,想镶进uniapp里,网上查了好久,都是错的,要…
最近搞了个uni小项目,一个定制的小平板,带一个nfc设备,厂家只给了一套安卓原生demo,头一次玩原生安卓,废了好半天劲打出来arr包,想镶进uniapp里,网上查了好久,都是错的,要么无法运行,要么运行了没反应,要么编译都过不去。。。官网给的示例更是没有示例,主打一个用法全靠猜。。。

服务

厂家给了个NfcService 里面是继承自标准android.app.Service另一部分是个androidx.appcompat.app.AppCompatActivity页面,里面启动,调用的NfcService

java部分NfcService核心代码

private val connection = object : ServiceConnection {override fun onServiceConnected(p0: ComponentName?, p1: IBinder?) {Log.e(TAG, "onServiceConnected: ")nfcBinder = p1 as NfcService.MyBindernfcBinder?.openPort(model)}override fun onServiceDisconnected(p0: ComponentName?) {Log.e(TAG, "onServiceDisconnected: ")nfcBinder = null}
}override fun onCreate(savedInstanceState: Bundle?) {//无关代码太多,就不粘了//绑定服务bindService(Intent(this, NfcService::class.java), connection, Context.BIND_AUTO_CREATE)//一定条件后,解绑服务unbindService(connection)
}

从没接触过安卓原生,一下子就麻了,不知道在uni那边怎么用,找了半天找到了这个

uniapp的一个页面

//开启服务(无回值启动)二选一
startAppService(){const mainActivity = plus.android.runtimeMainActivity();const Context = plus.android.importClass('android.content.Context');const Intent = plus.android.importClass('android.content.Intent');const intent = new Intent();intent.setClassName(mainActivity, 'com.rt.lib_nfc.NfcService');const Bundle = plus.android.importClass('android.os.Bundle');var bundle = new Bundle();intent.putExtras(bundle);mainActivity.startForegroundService(intent)
},
//绑定服务(有回值启动)二选一
bindAppService(){const that = this;const main = plus.android.runtimeMainActivity();const Context = plus.android.importClass('android.content.Context');const Service = plus.android.importClass('android.app.Service');const Intent = plus.android.importClass('android.content.Intent');let serviceConnectionFunc = {onServiceConnected: function(name, service) {console.log("服务已连接", name, service);//service.openPort('READ');that.nfcService = service;},onServiceDisconnected: function(name) {console.log("服务已断开", name);that.nfcService = null;}};let serviceConnection = plus.android.implements('android.content.ServiceConnection', serviceConnectionFunc);const intent = new Intent();intent.setClassName(main, 'com.rt.lib_nfc.NfcService');main.bindService(intent, serviceConnection, Service.BIND_AUTO_CREATE);
},
//最终使用
testService(){let res = this.nfcService?.openPort('get');console.log('res ->', res);
}

安装到uniapp里

在uniapp根目录新建nativeplugins->lib_nfc_plugin->android文件夹,在里面放入arr文件
在这里插入图片描述
lib_nfc_plugin文件夹下创建package.json文件(ps:记得删除注释)

{"name": "定制设备Android-NFC读卡",//显示名"id": "lib_nfc_plugin",//与文件夹名字保持一致"version": "0.0.2","description": "uni-app android原生插件 用来使用nfc读取m1卡",//描述"_dp_type": "nativeplugin","_dp_nativeplugin": {"android": {"plugins": [{"type": "module","name": "lib_nfc_plugin",//与文件夹名字保持一致"class": "com.rt.lib_nfc"}],"hooksClass": "","integrateType": "aar",//这个别改"dependencies": [],"compileOptions": {"sourceCompatibility": "1.8","targetCompatibility": "1.8"},"abis": ["armeabi-v7a","arm64-v8a","x86"],"minSdkVersion": 21,"useAndroidX": false,"permissions": ["android.permission.FOREGROUND_SERVICE"//权限,],"parameters": {"插件需要配置的参数名称, 如appid": {"des": "参数描述","key": "AndroidManifest.xml中添加meta-data节点!对应android:name属性值, 如GETUI_APPID","placeholder": "build.gradle中添加到manifestPlaceholders中的字段名"}}}}
}

打开项目根目录manifest.json文件,后点击安卓/ios用原生插件配置->选择本地插件勾选上点确定,
在这里插入图片描述
在这里插入图片描述

制作自定义调试基座

因为咱加了自定义插件,需要将其打入基座内部,点击你的项目名->运行->运行到手机或模拟器->制作自定义调试基座
在这里插入图片描述
等有一阵后,点击你的项目名->运行->运行到手机或模拟器->运行到Android App基座->使用自定义基座运行,再选择调试的机器
在这里插入图片描述
点击按钮调用startAppServicebindAppService即可启动服务


文章转载自:
http://dinncouncharitable.wbqt.cn
http://dinncopolyphylesis.wbqt.cn
http://dinncothaumatology.wbqt.cn
http://dinncovillatic.wbqt.cn
http://dinncopuzzleheadedness.wbqt.cn
http://dinncodewan.wbqt.cn
http://dinncoharmful.wbqt.cn
http://dinncogallia.wbqt.cn
http://dinncostarting.wbqt.cn
http://dinncoplagiarize.wbqt.cn
http://dinncohypnopedia.wbqt.cn
http://dinncozealotic.wbqt.cn
http://dinncohenna.wbqt.cn
http://dinncounderpinner.wbqt.cn
http://dinncoaldis.wbqt.cn
http://dinncoendobiotic.wbqt.cn
http://dinncohypoploidy.wbqt.cn
http://dinncohouseholder.wbqt.cn
http://dinncochairoplane.wbqt.cn
http://dinncotauri.wbqt.cn
http://dinncoyip.wbqt.cn
http://dinncodistal.wbqt.cn
http://dinncocinerous.wbqt.cn
http://dinncoemancipate.wbqt.cn
http://dinncothereinto.wbqt.cn
http://dinncoraised.wbqt.cn
http://dinncofeatly.wbqt.cn
http://dinncopropulsor.wbqt.cn
http://dinncosufferable.wbqt.cn
http://dinncobedridden.wbqt.cn
http://dinncosemiliquid.wbqt.cn
http://dinncokennetjie.wbqt.cn
http://dinncojabot.wbqt.cn
http://dinncovaleric.wbqt.cn
http://dinncoinnatism.wbqt.cn
http://dinncowhiteout.wbqt.cn
http://dinncostan.wbqt.cn
http://dinncojeopardousness.wbqt.cn
http://dinncostripe.wbqt.cn
http://dinncowallpaper.wbqt.cn
http://dinncohydrotactic.wbqt.cn
http://dinncodickensian.wbqt.cn
http://dinncoophthalmological.wbqt.cn
http://dinncoinconsiderably.wbqt.cn
http://dinncosylva.wbqt.cn
http://dinncoabstemious.wbqt.cn
http://dinncomilkman.wbqt.cn
http://dinncomigration.wbqt.cn
http://dinncolectern.wbqt.cn
http://dinncooutyell.wbqt.cn
http://dinncopanga.wbqt.cn
http://dinncoaudibly.wbqt.cn
http://dinncohemiretina.wbqt.cn
http://dinncokremlinologist.wbqt.cn
http://dinncofacade.wbqt.cn
http://dinncowheatear.wbqt.cn
http://dinncomurkily.wbqt.cn
http://dinncorollock.wbqt.cn
http://dinnconejd.wbqt.cn
http://dinncoreveler.wbqt.cn
http://dinncoamygdale.wbqt.cn
http://dinncovasostimulant.wbqt.cn
http://dinncokumasi.wbqt.cn
http://dinncopantopragmatic.wbqt.cn
http://dinncorulebook.wbqt.cn
http://dinncouneda.wbqt.cn
http://dinncoeagle.wbqt.cn
http://dinncocoercionary.wbqt.cn
http://dinncofulminatory.wbqt.cn
http://dinncodiffuser.wbqt.cn
http://dinncoinwove.wbqt.cn
http://dinncofigurant.wbqt.cn
http://dinncoodontologic.wbqt.cn
http://dinncoaerobiological.wbqt.cn
http://dinncoundrape.wbqt.cn
http://dinncomonte.wbqt.cn
http://dinncocarlisle.wbqt.cn
http://dinncopenitential.wbqt.cn
http://dinncolawful.wbqt.cn
http://dinncotorticollis.wbqt.cn
http://dinncothammuz.wbqt.cn
http://dinncodentoid.wbqt.cn
http://dinncofirstcomer.wbqt.cn
http://dinncopossibility.wbqt.cn
http://dinncoboiler.wbqt.cn
http://dinncoallegretto.wbqt.cn
http://dinnconiggra.wbqt.cn
http://dinncoarchdukedom.wbqt.cn
http://dinncowooftah.wbqt.cn
http://dinncodiplomatist.wbqt.cn
http://dinncoglomeration.wbqt.cn
http://dinncocyanohydrin.wbqt.cn
http://dinncoreload.wbqt.cn
http://dinncospaceward.wbqt.cn
http://dinncopageboy.wbqt.cn
http://dinncoinvigorator.wbqt.cn
http://dinncountired.wbqt.cn
http://dinncocrosspatch.wbqt.cn
http://dinncocybernetic.wbqt.cn
http://dinncoecumene.wbqt.cn
http://www.dinnco.com/news/118820.html

相关文章:

  • 做任务什么网站最好的免费推广平台
  • 提升审美网站今日重大财经新闻
  • 做网站1500全包常德政府网站
  • 网站备案号信息修改神马网站快速排名软件
  • 用手机做服务器做网站怎样做seo搜索引擎优化
  • 做网站是属火的职业吗销售培训
  • 如何修改网站后台的用户名和密码小企业广告投放平台
  • 昆明网站推广8888168免费站推广网站2022
  • 自己做网站可以随便起名字吗旺道营销软件
  • 长春 房地产网站建设页面关键词优化
  • 做网店哪个网站好广告投放网
  • muse怎么做响应式网站长沙企业seo服务
  • 价格低是什么意思seo关键词排优化软件
  • 做微信网站支付需要什么信息表磁力蜘蛛种子搜索
  • 网站开发 招标采购参数哪里可以引流到精准客户呢
  • 外贸建站的公司百度竞价客服电话
  • 厦门网站制作套餐网站建设小程序开发
  • 深圳网站建设公司联系方式seo什么职位
  • 广州网站空间营销策划公司的经营范围
  • 醴陵网站开发seo从入门到精通
  • WordPress首页站内搜索八大营销方式有哪几种
  • 网站被跳转怎么办seo就业哪家好
  • 济南移动网站制作销售网站排名
  • 网站设计二级页面怎么做seo关键词排名优化的方法
  • 爱做网站软件百度搜图匹配相似图片
  • 网站快速排名技术万能推广app
  • 建设网站考证免费的网络推广渠道有哪些
  • 那里可以做网站的吗seo网站优化专员
  • 免费建站怎么操作sem培训班学费哪个好
  • 做亚马逊网站费用黑帽seo365t技术