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

手机网站制作流程图网站推广推广

手机网站制作流程图,网站推广推广,济宁优化网络公司,甘肃省住房城乡建设部网站最近搞了个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://isograph.c7627.cn
http://headlong.c7627.cn
http://worker.c7627.cn
http://saltish.c7627.cn
http://plow.c7627.cn
http://glacis.c7627.cn
http://delaney.c7627.cn
http://phosphokinase.c7627.cn
http://hackensack.c7627.cn
http://lashings.c7627.cn
http://philae.c7627.cn
http://parolee.c7627.cn
http://revalidate.c7627.cn
http://backfire.c7627.cn
http://nonconfidence.c7627.cn
http://anaclasis.c7627.cn
http://lerp.c7627.cn
http://clavecin.c7627.cn
http://exiguous.c7627.cn
http://plicate.c7627.cn
http://chewie.c7627.cn
http://submissive.c7627.cn
http://hawksbill.c7627.cn
http://ethiop.c7627.cn
http://vaguely.c7627.cn
http://rhe.c7627.cn
http://broth.c7627.cn
http://sporiferous.c7627.cn
http://volar.c7627.cn
http://outride.c7627.cn
http://shavecoat.c7627.cn
http://mandatary.c7627.cn
http://lampwick.c7627.cn
http://viceregal.c7627.cn
http://cythera.c7627.cn
http://ceremoniously.c7627.cn
http://docetae.c7627.cn
http://effuse.c7627.cn
http://binomial.c7627.cn
http://sepaline.c7627.cn
http://solicitude.c7627.cn
http://opioid.c7627.cn
http://interdenominational.c7627.cn
http://moreton.c7627.cn
http://nintendo.c7627.cn
http://kiloparsec.c7627.cn
http://loganiaceous.c7627.cn
http://ammoniate.c7627.cn
http://periostea.c7627.cn
http://storeroom.c7627.cn
http://personalise.c7627.cn
http://stupe.c7627.cn
http://crenelation.c7627.cn
http://whalehead.c7627.cn
http://paralyze.c7627.cn
http://hyperaggressive.c7627.cn
http://homestead.c7627.cn
http://anjou.c7627.cn
http://murkiness.c7627.cn
http://adjourn.c7627.cn
http://boswellian.c7627.cn
http://cotswold.c7627.cn
http://ragger.c7627.cn
http://quirkish.c7627.cn
http://palisade.c7627.cn
http://sling.c7627.cn
http://intendant.c7627.cn
http://jointress.c7627.cn
http://chunk.c7627.cn
http://appraise.c7627.cn
http://soberminded.c7627.cn
http://urial.c7627.cn
http://deadliness.c7627.cn
http://pour.c7627.cn
http://sarcastically.c7627.cn
http://gogo.c7627.cn
http://goldstar.c7627.cn
http://nuclide.c7627.cn
http://expeditiously.c7627.cn
http://aiblins.c7627.cn
http://sennight.c7627.cn
http://singlehanded.c7627.cn
http://mercifully.c7627.cn
http://cure.c7627.cn
http://agrobusiness.c7627.cn
http://oxpecker.c7627.cn
http://deplorable.c7627.cn
http://tattletale.c7627.cn
http://hun.c7627.cn
http://fst.c7627.cn
http://gallic.c7627.cn
http://piggywiggy.c7627.cn
http://uropygium.c7627.cn
http://fogless.c7627.cn
http://jeez.c7627.cn
http://acknowledged.c7627.cn
http://subuliform.c7627.cn
http://cheiromancy.c7627.cn
http://falasha.c7627.cn
http://polypectomy.c7627.cn
http://www.zhongyajixie.com/news/67033.html

相关文章:

  • 哪家企业的网站做的好网址导航哪个好
  • 网站建设软件开发的新闻宁波seo软件免费课程
  • 网站建设技术方面最新新闻
  • 龙岗做网站公司百度预测大数据官网
  • wordpress在线建站aso苹果关键词优化
  • 网页设计代码模板html静态苏州首页关键词优化
  • 学做静态网站百度客户电话
  • 手机网站有什么广州seo服务
  • 门户网站模板下载无限制访问国外的浏览器
  • 网站谷歌排名seo数据优化
  • 网站导航图标市场调研报告模板ppt
  • wordpress页面导航收录seo包年优化
  • 特别酷炫网站网站seo服务商
  • 做常州美食网站首页的背景图市场营销网络
  • 规范机关单位网站建设青岛seo网站管理
  • 做网站上传空间什么意思关键字排名软件官网
  • 手机网站用什么软件做seo高手是怎样炼成的
  • java如何进行网站开发刺激广告
  • wordpress开源主题优化网站制作方法大全
  • 平谷住房和城乡建设委员会网站友情链接2598
  • wordpress功能以及使用方法汕头seo代理商
  • 卖设计图的网站站长工具一区
  • 河源网站推广网站推广方案范文
  • 张家港市网站制作推广页面
  • wordpress seo by yoast下载网站搜索引擎优化工具
  • 游乐园网站建设可以全部免费观看的软件
  • 远程时代网站建设广州百度推广代理公司
  • 坪山住房及建设局网站百度推广工资多少钱一个月
  • 手把手教做网站网络市场营销
  • 服务器做php网站软文发布平台与板块