Failed to bind to the service
Asked Answered
M

5

16

On the app launch, I need to check whether a new version is available on play store or not. To check I have implemented below code in Splash screen.

private void checkNewVersionAvailability() {
    appUpdateManager = AppUpdateManagerFactory.create(getApplicationContext());
    appUpdateInfo = appUpdateManager.getAppUpdateInfo();

    appUpdateInfo.addOnCompleteListener(new OnCompleteListener<AppUpdateInfo>() {
        @Override
        public void onComplete(Task<AppUpdateInfo> task) {
            if (task.isComplete()) {
                if (task.getResult().updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
                    checkVersion(task.getResult());
                } else if (task.getResult().updateAvailability() == UpdateAvailability.UPDATE_NOT_AVAILABLE) {
                    if (StringUtils.isNullOrEmpty(ChevronApplication.deviceId)) {
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                RegsiterDeviceHandler handler = new RegsiterDeviceHandler(SplashScreen.this);
                                handler.registerDevice(false);
                                handler.showNextScreen();
                            }
                        }, SLEEP_TIME);
                    } else {
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                new RegsiterDeviceHandler(SplashScreen.this).showNextScreen();
                            }
                        }, SLEEP_TIME);
                    }
                }
            }
        }
    });

During testing on the device, I didn't get the issue. These crash logs are I found from the Pre-launch report in Playstore. enter image description here

> FATAL EXCEPTION: main
Process: com.mac.app, PID: 19641
com.google.android.play.core.tasks.RuntimeExecutionException: com.google.android.play.core.internal.aa: Failed to bind to the service.
    at com.google.android.play.core.tasks.k.getResult(Unknown Source)
    at com.chevronrenaissance.app.activity.SplashScreen$2.onComplete(SplashScreen.java:113)
    at com.google.android.play.core.tasks.a.run(Unknown Source)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5538)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: com.google.android.play.core.internal.aa: Failed to bind to the service.
    at com.google.android.play.core.internal.q.b(Unknown Source)
    at com.google.android.play.core.internal.q.a(Unknown Source)
    at com.google.android.play.core.internal.s.a(Unknown Source)
    at com.google.android.play.core.internal.r.run(Unknown Source)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.os.HandlerThread.run(HandlerThread.java:61)
Mudguard answered 31/10, 2019 at 6:34 Comment(1)
Have you by any chance resolved this issue?Slovakia
T
3

There seems to be an issue with Google Play Core library with Android Virtual Devices. I had to add a try/catch statement so the Pre-launch testing passes. I think you may have to wrap al your AppUpdateManager calls so the exception is catched.

Tinnitus answered 10/12, 2019 at 12:1 Comment(0)
D
2

I was running a very similar issue using the in-app review component. It turned out one of the emulators I was developing with had not been signed into a Google Play account. You may want to ensure your emulator is signed into Google Play.

Dither answered 14/3, 2021 at 1:33 Comment(1)
For me, a device not signed in to Play gives an InstallErrorCode.ERROR_APP_NOT_OWNED, but this line "Failed to bind to the service" isn't an isntance of InstallException, seems to be something else.Coronograph
R
1

You can check task.isSuccessful(). In this case, when the task is not successful, you can get the exception use method task.getException()

Reciprocity answered 25/12, 2019 at 9:51 Comment(0)
B
0

Most likely that the Emulator you are using do not contain Google Play at all.

Beniamino answered 22/4, 2022 at 21:42 Comment(0)
R
-1

If you are running it in a emulator and if emulator is not signed for Google play, it will show the error that "PID: [6084] AppUpdateService : Failed to bind to the service."

Runaway answered 20/7, 2022 at 8:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.