Open ducta99 opened 2 years ago
Android 11 need declaring package visibility
https://developer.android.com/training/package-visibility/declaring
@ducta99, Sorry for the long delay in replying.
NdkBinderService APK only contains the Android Service implemented in C++ (no need to have an Activity in this APK). JavaBinderClient APK contains the Android Activity which binds the Android Service and calls service APIs.
First, build and install the NdkBinderService APK.
$ ./gradlew NdkBinderService:assembleDebug
$ adb install -f NdkBinderService/build/outputs/apk/debug/NdkBinderService-debug.apk
Because NdkBinderService APK doesn't contain any main Activity, nothing will appear in the app launcher for NdkBinderService.
Then, build and install the JavaBinderClient APK.
$ ./gradlew JavaBinderClient:assembleDebug
$ adb install -f JavaBinderClient/build/outputs/apk/debug/JavaBinderClient-debug.apk
JavaBinderClient APK have a main Activity that will appear in the app launcher.
When I follow above 3 steps, JavaBinderClient Activity works for me everytime and displays expected output message. I am on Android 10.
@ducta99, You are correct. It doesn't work on Android 11. @xfan1024's suggestion can be the fix for this issue. I'll check from my side. Thanks @xfan1024 for the suggestion.
Hi Lakindu Boteju, I am new to ndk-binder. I try to use your original repository but it blocked at "Waiting to talk to IMyService...". Then I added MainActivity to the Server side( for example, NdkBinderService), and it works. In addition, If I kill the Server app (NdkBinderService), the Client (JavaBinderClient) will be blocked at "Waiting to talk to IMyService..." as before. I think your original repository should work without running App because you originally do not have MainActivity for Server sides. Please correct me if there is any misunderstanding.