gpt4 book ai didi

Android 应用程序开始使用 cordova-webintent 更新并强制停止

转载 作者:行者123 更新时间:2023-12-03 13:24:20 24 4
gpt4 key购买 nike

步骤:

  • 我打开了 android 应用程序(使用 cordova 构建)
  • 然后我打了 cordova-webintent 用于安装更新
  • 我按下安装并开始安装,但几秒钟后,应用程序强制停止并关闭,而不是安装和打开更新的应用程序。

  • 这个问题前段时间出现过,不明白为什么会这样,因为 cordova-webintent的版本和 cordova是相同的。
  • 应用程序强制停止后,我点击了应用程序图标,但出现“应用程序未安装”的消息。该应用程序会在几秒钟后继续在后台安装。我再次点击应用程序图标并打开更新的应用程序。

  • 为什么安装时应用程序强制停止?
    日志:
    E:\work\hello1>adb logcat ActivityManager:I com.example.hello1:D *:S

    --------- beginning of system

    I/ActivityManager( 715): [Background Service Priority Adjustment] Set callerFg as false for service.getFlags():260

    I/ActivityManager( 715): START u0 {act=android.intent.action.VIEW dat=file:///storage/emulated/0/filename1.apk typ=application/vnd.android.package-archive cmp=com.android.packageinstaller/.PackageInstallerActivity} from uid 10657 on display 0

    --------- beginning of main

    I/ActivityManager( 715): START u0 {dat=file:///storage/emulated/0/filename1.apk cmp=com.android.packageinstaller/.InstallAppProgress (has extras)} from uid 10072 on display 0
    I/ActivityManager( 715): [AppLaunch] Displayed Displayed com.android.packageinstaller/.InstallAppProgress: +135ms

    I/ActivityManager( 715): Force stopping com.example.hello1 appid=10657 user=-1: uninstall pkg

    I/ActivityManager( 715): Killing 19149:com.example.hello1/u0a657 (adj 1): stop com.example.hello1

    W/ActivityManager( 715): notify app switch quit packageName=com.example.hello1
    I/ActivityManager( 715): Force finishing activity ActivityRecord{16a2ad7e u0 com.example.hello1/.MainActivity t2758}

    I/ActivityManager( 715): Force finishing activity ActivityRecord{32eb6933 u0 com.android.packageinstaller/.InstallAppProgress t2758}

    **W/ActivityManager( 715): Spurious death for ProcessRecord{2590ad4d 19149:com.example.hello1/u0a657}, curProc for 19149: null**

    I/ActivityManager( 715): Force stopping com.example.hello1 appid=10657 user=-1: update pkg
    I/ActivityManager( 715): Force stopping com.example.hello1 appid=10657 user=0: pkg removed

    最佳答案

    我有两个潜在的原因来处理您的问题:

  • 线程相关问题,取决于手机或平板电脑的类型
    处理器(有多少线程可以同时运行)记住
    该cordoba-webintent 是一个基于异步的调用。
  • 两个相同的版本(cordoba-webintent 和 cordoba)可能会丢失
    常用插件。 (插件本来应该在那里,但不包括在内!)

  • 在第一种情况下,首先检查您的 list :
    <intent-filter>
    <action android:name="com.example.yourapplication.hello1" />
    <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    当然,它应该有一个唯一的名称。
    然后在您调用 webintent 的地方检查您的 java 代码
    startActivity({action: 'com.example.yourapplication.hello1'}) 
    一个 try{}在这里可以方便地测试 webintent 是否在您的应用程序的 MainActivity() 之前或之后触发。 .如果您的 MainActivity() (has extras),还要检查 Intent “触发”顺序。论据。
    第二种情况是:
  • gitHub下载cordoba-webintent
  • 构建您的 apk
  • 解压找到插件目录
  • 在你的项目中包含这个插件目录
  • 这种方式将确保 webintent 安装了最新的
    更新并且在您运行的自动更新期间没有任何问题
    之前。

  • 我希望为您的案例指出不同的方法!

    关于Android 应用程序开始使用 cordova-webintent 更新并强制停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41168359/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com