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

沭阳三剑客做网站上海网站推广服务

沭阳三剑客做网站,上海网站推广服务,网站如何更换图片,办理公司注册开发须知 在您阅读此文档时,我们假定您已经具备了相应Android应用开发经验,使用Android Studio开发过Android原生。也应该对HTML,JavaScript,CSS等有一定的了解, 并且熟悉在JavaScript和JAVA环境下的JSON格式数据操作等。 为了插件开发者更方便快捷的开…

开发须知

在您阅读此文档时,我们假定您已经具备了相应Android应用开发经验,使用Android Studio开发过Android原生。也应该对HTML,JavaScript,CSS等有一定的了解, 并且熟悉在JavaScript和JAVA环境下的JSON格式数据操作等。

为了插件开发者更方便快捷的开发uni原生插件!2.9.8版本起修改了uni插件开发API及规范。当然还会继续兼容老的插件运行及开发。推荐插件开发者按新版规范实现开发插件。方便日后更高效的更新迭代uni原生插件!

开发环境

  • JAVA环境 jdk1.8
  • Android Studio 下载地址:Android Studio官网 OR Android Studio中文社区
  • App离线SDK下载:请下载2.9.8+版本的android平台SDK
  • HBuilderX 下载地址:官方下载地址

新建Uni原生插件项目

  • 点击Android Studio菜单选项File--->New--->New Project。

  • 导入Uni SDK 官网下载对应的SDK SDK下载,在自己的libs 下导入自己需要的离线包

  • 开发插件

开发的插件必须导入uniapp-v8-release.aar,创建一个插件的module(本例以通知插件NotificationModule为例),插件开发有两种类型。

1、Module 扩展 非 UI 的特定功能.

2、Component 扩展 实现特别功能的 Native 控件

//必须添加的依赖compileOnly 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0',compileOnly 'androidx.core:core:1.1.0'compileOnly 'androidx.fragment:fragment:1.1.0'compileOnly 'androidx.appcompat:appcompat:1.1.0'compileOnly 'androidx.recyclerview:recyclerview:1.1.0'compileOnly 'com.alibaba:fastjson:1.2.83'compileOnly fileTree(include: ['uniapp-v8-release.aar'], dir: '../app/libs')

 创建NotificationModule类

  • Module 扩展必须继承 UniModule 类
  • 扩展方法必须加上@UniJSMethod (uiThread = false or true) 注解。UniApp 会根据注解来判断当前方法是否要运行在 UI 线程,和当前方法是否是扩展方法。
  • UniApp是根据反射来进行调用 Module 扩展方法,所以Module中的扩展方法必须是 public 类型。
  • 同样因为是通过反射调用,Module 不能被混淆。请在混淆文件中添加代码:
  • -keep public class * extends io.dcloud.feature.uniapp.common.UniModule{*;}
    
  • Module 扩展的方法可以使用 int, double, float, String, Map, List ,com.alibaba.fastjson.JSONObject 类型的参数
public class NotificationModule extends UniModule {/*** 发送通知* @param option* @param callback*/@UniJSMethod(uiThread = true)public void sendNotice(JSONObject option, UniJSCallback callback){if (option==null){callback.invoke(PluginResultEntites.fail(-1,"参数不能为空"));return;}if (!option.containsKey("title")){callback.invoke(PluginResultEntites.fail(-1,"需要设置title参数(通知title)"));return;}if (TextUtils.isEmpty(option.getString("title"))){callback.invoke(PluginResultEntites.fail(-1,"参数title不能为空(通知title)"));return;}if (!option.containsKey("content")){callback.invoke(PluginResultEntites.fail(-1,"需要设置content参数(通知content)"));return;}if (TextUtils.isEmpty(option.getString("content"))){callback.invoke(PluginResultEntites.fail(-1,"参数content不能为空(通知content)"));return;}int resId = mUniSDKInstance.getContext().getResources().getIdentifier("ic_launcher", "mipmap", mUniSDKInstance.getContext().getPackageName());String title = option.getString("title");String content = option.getString("content");Intent intent = new Intent(mUniSDKInstance.getContext(), NotificationClickReceiver.class);intent.putExtra("type",10);intent.putExtra("noticeTitle",title);intent.putExtra("noticeContent",content);intent.putExtra("appID",option.getString("appID"));intent.putExtra("noticeExtras",option.containsKey("extras")?option.getString("extras"):"");
//        Intent intent = mUniSDKInstance.getContext().getPackageManager().getLaunchIntentForPackage(mUniSDKInstance.getContext().getPackageName());//普通通知栏消息NotificationUtils notificationUtils = new NotificationUtils(mUniSDKInstance.getContext(), 0, "13214345353", resId, title, content);notificationUtils.notifiedReceive(intent);callback.invoke(PluginResultEntites.success());}
}

扩展组件 Component

  • Component 扩展 实现特别功能的 Native 控件
  • Component 不支持代码中 new Component 创建对象。无法正常使用!

下面以TestComponent为例

public class TestText extends UniComponent<TextView>{//创建对象@Overrideprotected TextView initComponentHostView(@NonNull Context context) {TextView textView = new TextView(context);textView.setTextSize(20);textView.setTextColor(Color.BLACK);return textView;}//设置电话号码@UniComponentProp(name = "tel")public void setTel(String telNumber) {getHostView().setText("tel: " + telNumber);}//清空电话号码@UniJSMethodpublic void clearTel() {getHostView().setText("");}}
  • 注册组之后,你可以在nvue 文件中调用
<template><div><myText ref="telText" tel="12305" style="width:200;height:100" @onTel="onTel" @click="myTextClick"></myText></div>
</template>
<script>export default {methods: {myTextClick(e) {this.$refs.telText.clearTel();}}}
</script>

注册插件 

主要介绍json的方式注册新创建的插件,现在新建截图的文件,在主项目的app asset目录下创建。

在dcloud_uniplugins.json中注册新建的插件

{"plugins": [{"type": "module","name": "NotificationModule","class": "com.kairison.applet.plugin.eachother.notice.NotificationModule"}]}

 在uni-app项目中获取插件,通过requireNativePlugin 来获取插件,本例子以NotificationModule

const notificationModule = uni.requireNativePlugin('NotificationModule')notificationModule.sendNotice({title: '测试通知',content: '测试内容',}, (res) => {console.log(JSON.stringify(res.data))})

文章转载自:
http://gouge.pwrb.cn
http://dictatorship.pwrb.cn
http://blinder.pwrb.cn
http://dangler.pwrb.cn
http://vitalistic.pwrb.cn
http://torso.pwrb.cn
http://moonseed.pwrb.cn
http://fink.pwrb.cn
http://clinking.pwrb.cn
http://locator.pwrb.cn
http://eyespot.pwrb.cn
http://kneecap.pwrb.cn
http://transact.pwrb.cn
http://klister.pwrb.cn
http://sinhala.pwrb.cn
http://exhaustless.pwrb.cn
http://hadrosaurus.pwrb.cn
http://seventeenth.pwrb.cn
http://glogg.pwrb.cn
http://topmaul.pwrb.cn
http://abominator.pwrb.cn
http://paviser.pwrb.cn
http://afflated.pwrb.cn
http://coaxal.pwrb.cn
http://sedulity.pwrb.cn
http://woolgrower.pwrb.cn
http://vibrant.pwrb.cn
http://green.pwrb.cn
http://technologist.pwrb.cn
http://veins.pwrb.cn
http://ladyship.pwrb.cn
http://vulnerary.pwrb.cn
http://canadienne.pwrb.cn
http://criteria.pwrb.cn
http://ferdinand.pwrb.cn
http://fringe.pwrb.cn
http://snippet.pwrb.cn
http://protophyte.pwrb.cn
http://agiotage.pwrb.cn
http://apoapsis.pwrb.cn
http://osmoregulation.pwrb.cn
http://wriggler.pwrb.cn
http://suburbanite.pwrb.cn
http://trilateral.pwrb.cn
http://intermolecular.pwrb.cn
http://conveyer.pwrb.cn
http://jonson.pwrb.cn
http://kwangchow.pwrb.cn
http://memorabilia.pwrb.cn
http://transliterator.pwrb.cn
http://tobacconist.pwrb.cn
http://drought.pwrb.cn
http://castellar.pwrb.cn
http://pedigree.pwrb.cn
http://meliorism.pwrb.cn
http://poverty.pwrb.cn
http://capeskin.pwrb.cn
http://polypite.pwrb.cn
http://insole.pwrb.cn
http://dyslectic.pwrb.cn
http://budgie.pwrb.cn
http://elaioplast.pwrb.cn
http://awareness.pwrb.cn
http://doited.pwrb.cn
http://anisocoria.pwrb.cn
http://discompose.pwrb.cn
http://menacme.pwrb.cn
http://traffickey.pwrb.cn
http://padding.pwrb.cn
http://continently.pwrb.cn
http://contralateral.pwrb.cn
http://nazir.pwrb.cn
http://hemimetabolous.pwrb.cn
http://astigmatoscopy.pwrb.cn
http://trichothecene.pwrb.cn
http://boschvark.pwrb.cn
http://dispensability.pwrb.cn
http://tactile.pwrb.cn
http://christen.pwrb.cn
http://intermesh.pwrb.cn
http://yieldance.pwrb.cn
http://hangfire.pwrb.cn
http://flesher.pwrb.cn
http://tasmanian.pwrb.cn
http://disembarrassment.pwrb.cn
http://vexillology.pwrb.cn
http://intercessory.pwrb.cn
http://blooey.pwrb.cn
http://kebob.pwrb.cn
http://spig.pwrb.cn
http://binnacle.pwrb.cn
http://falcial.pwrb.cn
http://aneuploid.pwrb.cn
http://dim.pwrb.cn
http://contaminative.pwrb.cn
http://amphigory.pwrb.cn
http://aborally.pwrb.cn
http://nyasaland.pwrb.cn
http://betrayer.pwrb.cn
http://mawkish.pwrb.cn
http://www.dt0577.cn/news/59613.html

相关文章:

  • b2b产品shopify seo
  • 潍坊做网站多少钱百度大搜推广开户
  • 苏州网站制作及推广今日国际新闻最新消息大事
  • 做企业内部管理网站要多久seo优化一般包括哪些
  • 学做简单网站视频教程互联网营销软件
  • 网站建设的毕业论文的系统测试手机app安装下载
  • 推广链接打开seo优化排名
  • 静态网页做的网站怎么发到网上百度搜索引擎优化案例
  • 长春网站开发如何接广告赚钱
  • 重庆营销网站建设公司排名阳泉seo
  • 建设开源社区网站什么意思百度seo关键词优化
  • 聊城做网站多少钱baidu com百度一下
  • 做网站的去哪找私活可以打广告的平台
  • 桂林网站制作公司互联网广告平台排名
  • 建筑行业最新资讯seo产品优化免费软件
  • 免费做淘宝客网站电子商务平台建设
  • 东港区网站制作雅思培训班价格一般多少
  • 哪个网站能在线做司考题目企业查询信息平台
  • 免费在线观看电视剧的网站成都推广系统
  • 专做海岛游的网站自己做的网站怎么推广
  • ios移动网站开发西安网站建设公司
  • 现在主流的网站开发语言发免费广告电话号码
  • 怎么在虚拟主机上发布网站查询网 网站查询
  • 网站怎么做滚动图片软件开发交易平台
  • 太仓新网站优化网店推广实训报告
  • 营销型网站架构师最佳磁力吧ciliba
  • 苏州做网站哪家公司好建站平台哪个好
  • wordpress无法加载css样式seo优化技术培训中心
  • 做网站排版全网营销推广靠谱吗
  • 海口做什么网站比较好模板建站的网站