93

Steps:

  1. I Opened the android application (built with cordova)

  2. Then I called cordova-webintent for installing updates

  3. I pressed Install and it starts installing, but after a few seconds, the app force stops and shuts instead of installing and opening the updated app.

This problem appeared some time ago and I can't understand why this happened, because the version of cordova-webintent and cordova are the same.

  1. After the app force stopped, I tapped on the application icon, but there is a message that "App isn't installed". The app continues installing in the background after some seconds. I tapped again on the application icon and the updated application opened.

Why is the app force stopping while installing?

Logs:

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
Osama Rizwan
  • 615
  • 1
  • 7
  • 19
YuliiaBoiko
  • 1,039
  • 6
  • 5
  • 2
    Could you provide some more info on this like Android version, cordova version and is it device specific? Also by any chance you application goes to background during updation? Please throws some light on this to dig deeper – Gandhi Dec 19 '16 at 15:06
  • 1
    - Android 5.0.1 - Cordova 6.3.1 - I checked on Lenovo and Samsung tablets. - Yes, application shuts down and goes to background while updating – YuliiaBoiko Dec 19 '16 at 16:30
  • 1
    Since the app goes to the background, i suspect that the intent event may not be firing as mentioned in the web intent plugin issues - https://github.com/Initsogar/cordova-webintent/issues/27 https://github.com/Initsogar/cordova-webintent/pull/28 Please check the links and let me know if it helps – Gandhi Dec 20 '16 at 05:17
  • 1
    @user3441891 If you can post an error log, it will be very helping. But according to available information, I guess you need to call this update operation on a seperate thread (something similar to async task), maybe it is working on main thread and that causes this problem. – Akram Dec 21 '16 at 08:05
  • @raina77ow Any error trace in device console during force stop? – Gandhi Dec 23 '16 at 12:26
  • 2
    @raina77ow Yes, I found this error "W/ActivityManager( 602): Spurious death for ProcessRecord{2ed1f0f5 27636:com.example.test/u0a183}, curProc for 27636: null" – YuliiaBoiko Jan 06 '17 at 15:32
  • Possible duplicate of [What is Spurious Death in Android?](https://stackoverflow.com/questions/29590251/what-is-spurious-death-in-android) – Martin Zeitler Jan 04 '19 at 00:28

1 Answers1

1

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!

George Gotsidis
  • 426
  • 4
  • 15