Android 应用程序开始更新科尔多瓦-网意图和强制停止

步骤:

  1. 打开 android 应用程序(使用 cordova构建)

  2. 然后我打电话给 cordova-webintent安装更新

  3. 我按下安装,它开始安装,但几秒钟后,应用程序强制停止和关闭,而不是安装和打开更新的应用程序。

这个问题出现在一段时间以前,我不能理解为什么会发生这种情况,因为 cordova-webintentcordova的版本是相同的。

  1. 应用程序强制停止后,我点击应用程序图标,但有一个消息“应用程序没有安装”。几秒钟后,应用程序继续在后台安装。我再次点击应用程序图标,打开了更新后的应用程序。

为什么应用程序强制在安装时停止?

日志:

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
1908 次浏览

I have two potential reasons dealing with your problem:

  • Thread related issue, depending on cellphone or tablet's type of processors (how many threads can run simultaneously) keep in mind that cordoba-webintent is an async based call.
  • Both same versions (cordoba-webintent and cordoba) might missing common plugins. (Plugins was meant to be there but not incuded!)

In the first scenario check your manifest first:

<intent-filter>
<action android:name="com.example.yourapplication.hello1" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Definitely it should have a unique name. Then check your java code, at the place you are calling webintent

startActivity({action: 'com.example.yourapplication.hello1'})

a try{} would be handy here to test if webintent fires before or after your application's MainActivity(). Also check the intent "fire" order, if your MainActivity() (has extras) arguments.

The second scenario is to:

  • download cordoba-webintent from gitHub
  • build your apk
  • extract it and find the plugin directory
  • include this plugin directory in your project
  • This way will assure that webintent is installed with the latest update and nothing was wrong during the automated update you run previously.

I hope to pin point a different approach to your case!