JingMatrix / ChromeXt

UserScript and DevTools supports for Chromium based and WebView based browsers
https://jingmatrix.github.io/ChromeXt/
GNU General Public License v3.0
695 stars 39 forks source link

Adapt general WebView applications to ChromeXt #159

Closed MikoNA77 closed 7 months ago

MikoNA77 commented 7 months ago

I installed your module and checked the webview app i want to use this module for but unfortunately it didnt work. Is there something that can be done to make this module works on that application. I have the source of the webview app that i want to make this module works Thanks! 20240325_212801

MikoNA77 commented 7 months ago

Update : I kinda get it working but it cant install userscript 20240325_235128

JingMatrix commented 7 months ago

Could you please upload a sample APK so that I can test your app?

MikoNA77 commented 7 months ago

Sure! app-release-MT2_sign.zip

JingMatrix commented 7 months ago

For ChromeXt to work, please create a subclass of WebChromeClient, and set it properly using setWebChromeClient.

After finishing this, please upload a new build of your app.

MikoNA77 commented 7 months ago

Done app-debug.zip

JingMatrix commented 7 months ago

Did your app run flawlessly on your devices? It cannot run on my device. Here is the log:

03-27 14:58:45.487 10207 10207 D AndroidRuntime: Shutting down VM
03-27 14:58:45.488 10207 10207 E AndroidRuntime: FATAL EXCEPTION: main
03-27 14:58:45.488 10207 10207 E AndroidRuntime: Process: com.application.griyabelajarexam, PID: 10207
03-27 14:58:45.488 10207 10207 E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.itsaky.androidide.logsender.LogSenderService: java.lang.SecurityException: Starting FGS with type dataSync callerApp=ProcessRecord{b726377 10207:com.application.griyabelajarexam/u0a42} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_DATA_SYNC] 
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4878)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2365)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:107)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.os.Looper.loopOnce(Looper.java:232)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:317)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:8501)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
03-27 14:58:45.488 10207 10207 E AndroidRuntime: Caused by: java.lang.SecurityException: Starting FGS with type dataSync callerApp=ProcessRecord{b726377 10207:com.application.griyabelajarexam/u0a42} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_DATA_SYNC] 
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.os.Parcel.createExceptionOrNull(Parcel.java:3182)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.os.Parcel.createException(Parcel.java:3166)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:3149)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:3091)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6861)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.app.Service.startForeground(Service.java:775)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at com.itsaky.androidide.logsender.LogSenderService.onCreate(LogSenderService.java:57)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4865)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    ... 9 more
03-27 14:58:45.488 10207 10207 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace:
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2685)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2375)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1704)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:13684)
03-27 14:58:45.488 10207 10207 E AndroidRuntime:    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3430)
03-27 14:58:45.488 10207 10207 E AndroidRuntime: 
MikoNA77 commented 7 months ago

Rebuilt it with release tag It should work now app-release-MT2_sign.zip

JingMatrix commented 7 months ago

You simply need to make your subclass effective. To do so, please overwrite at lease one method of the default WebChromeClient class. If you finish this, you will see the scripts installation works perfectly:

Screenshot_20240327-163213