Search code examples
androidcrashhockeyapp

App is getting crashed when I update app through UpdateManager using hockeyapp


My android app is getting crashed while I update the app through hockeyapp UpdateManager.

Here is my update code:

private void checkForUpdates() {
        // Remove this for store builds!
        UpdateManager.register(this, getResources().getString(R.string.hockey_app_id), new UpdateManagerListener() {
            @Override
            public void onNoUpdateAvailable() {
                super.onNoUpdateAvailable();

                // no update is available ->  load login screen
//                setFragment(R.id.container_login, new LoginFragment());
            }

            @Override
            public void onUpdateAvailable(JSONArray data, String url) {
                super.onUpdateAvailable(data, url);
            }
        }, true);
    }

it is showing update dialog but when i clicked update then after 100% loading app is getting crashed. Here is the crash log:

onFatalError, processing error from engine(4) com.google.android.apps.gsa.shared.speech.a.g: Error reading from input stream at com.google.android.apps.gsa.staticplugins.recognizer.i.a.a(SourceFile:342)

Any help would be appreciated. Thanks.


Solution

  • I just solved this problem by searching different documentations of hockeyApp. Here is solution of above problem:

    Check for updates method:

    private void checkForUpdates() {
    
            StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
            StrictMode.setVmPolicy(builder.build());
    
            UpdateManager.register(this, getResources().getString(R.string.hockey_app_id), new UpdateManagerListener() {
                @Override
                public void onNoUpdateAvailable() {
                    super.onNoUpdateAvailable();
    
                    // no update is available ->  load login screen
    //                setFragment(R.id.container_login, new LoginFragment());
                }
    
                @Override
                public void onUpdateAvailable(JSONArray data, String url) {
                    super.onUpdateAvailable(data, url);
                }
            }, true);
        }
    

    Also need to unregister Updatemanager in activity onPause() or onDestroy() method.

    private void unregisterManagers() {
            UpdateManager.unregister();
        }
    
        @Override
        public void onPause() {
            super.onPause();
            unregisterManagers();
        }
    
        @Override
        public void onDestroy() {
            super.onDestroy();
            unregisterManagers();
        }
    

    This is the complete solution of hockeyApp in app update feature.