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

商城网站建设 优帮云网店营销与推广策划方案

商城网站建设 优帮云,网店营销与推广策划方案,网站推广策划案格式及范文,东莞搭建网站要多少钱背景 通过deeplink启动应用之后,没关闭应用的情况下,再次使用deeplink会失效的问题,是系统bug导致的。此bug仅在某些设备(Nexus 5X)上重现,launchMode并且仅当应用程序最初通过深层链接启动并再次通过深层…

背景

通过deeplink启动应用之后,没关闭应用的情况下,再次使用deeplink会失效的问题,是系统bug导致的。此bug仅在某些设备(Nexus 5X)上重现,launchMode并且仅当应用程序最初通过深层链接启动并再次通过深层链接打开时才会重现。
在这里插入图片描述

在AndroidManifest中像这样设置了我的活动,即MainActivity。

<activityandroid:name="com.package.name.MainActivity"android:screenOrientation="portrait"android:theme="@style/Theme.AppTheme"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter><intent-filter><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /><data android:scheme="myscheme" android:host="myhost" /></intent-filter>
</activity>

并且在 LaunchActivity.onCreate() 中打印一个日志来表明它已经在那里了。
使用如下测试深层链接。

adb shell am start -W -a android.intent.action.VIEW -d "dlscheme://dlhost/param" some.package.name

在应用程序被终止后,使用上述命令,它可以打开应用程序并路由到正确的活动,没有问题。并且有以下日志。

adb shell am start -W -a android.intent.action.VIEW -d "dlscheme://dlhost/param" some.package.name
Starting: Intent { act=android.intent.action.VIEW dat=dlscheme://dlhost/param pkg=some.package.name }
Status: ok
Activity: some.package.name/.activity.LaunchActivity
ThisTime: 898
TotalTime: 898
WaitTime: 919
Complete

但是,如果再次输入相同的命令,而不终止应用程序。它只会打开应用程序,但不会打开正确的活动,并生成以下日志。

adb shell am start -W -a android.intent.action.VIEW -d "dlscheme://dlhost/param" some.package.name
Starting: Intent { act=android.intent.action.VIEW dat=dlscheme://dlhost/param pkg=some.package.name }
Warning: Activity not started, its current task has been brought to the front
Status: ok
Activity: some.package.name/.activity.LaunchActivity
ThisTime: 0
TotalTime: 0
WaitTime: 6
Complete

注意到有这一行
Warning: Activity not started, its current task has been brought to the front

解决方案

在项目的清单文件中,需要将以下内容添加到MainActivity中。

android:launchMode="singleTask"

并处理内部的深层链接onNewIntent()

@Override
protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_recipe);onNewIntent(getIntent());
}protected void onNewIntent(Intent intent) {String action = intent.getAction();String data = intent.getDataString();if (Intent.ACTION_VIEW.equals(action) && data != null) {String recipeId = data.substring(data.lastIndexOf("/") + 1);Uri contentUri = RecipeContentProvider.CONTENT_URI.buildUpon().appendPath(recipeId).build();showRecipe(contentUri);}
}
http://www.khdw.cn/news/55540.html

相关文章:

  • 政务公开做的好的网站有哪些女生读网络营销与电商直播
  • 旅游公司网页设计西安seo服务外包
  • 应用商店怎么下载seo网页优化服务
  • wordpress 文章阅读数游戏优化
  • 广告设计网站免费数字营销成功案例
  • 初学者怎么做php网站什么叫seo
  • 注册网站域名需要什么网站有吗免费的
  • 如何用魔方网表做门户网站必应搜索引擎网站
  • 怎样联系网站管理员百度投诉中心在线申诉
  • 网站建设kaituozu微信广点通广告平台
  • 怎么做网站360图片链接国内最新新闻消息今天的
  • 建设行业网上报名seo中介平台
  • 重庆 手机网站制作软文发布网站
  • 如何建设政府网站推广软件
  • 网站建设需求调研seo网站优化怎么做
  • 装潢网站模板广告发布平台app
  • 完成网站开发需要什么样技术百度导航和百度地图
  • 遵义交通建设网站seo 适合哪些行业
  • 怎么做高端品牌网站设计seo的含义是什么意思
  • 成品网站1688网页成都做网络推广的公司有哪些
  • ping一下新浪网站怎么做搜索引擎的优化方法
  • 做爰电影网站今天重大新闻国内最新消息
  • 尺寸在线做图网站阳泉seo
  • 网站打不开的解决方法百度入口网站
  • 网站管理助手 建设中百度风云搜索榜
  • 创意礼物网站建设与管理石家庄疫情最新情况
  • 360免费建站沈阳市网站
  • 织梦网站后台怎么登陆乐天seo培训中心
  • 网站企业备案改个人备案上海专业的seo推广咨询电话
  • vip解析网站如何做肇庆seo外包公司