Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android SDK Webbridge, not all javascript files seem to be loaded correctly #607

Open
revolucion opened this issue Jul 19, 2024 · 0 comments

Comments

@revolucion
Copy link

revolucion commented Jul 19, 2024

Hi,

I have been trying to set up a web bridge connection to an Android app.
I managed to get it working on iOS, so my setup in the web-app part seems to be working correctly.

Using Adjust Android SDK & web bridge version 4.38.5.

The build.gradle file has these 2 dependencies added:

    implementation 'com.adjust.sdk:adjust-android:4.38.5'
    implementation 'com.adjust.sdk:adjust-android-webbridge:4.38.5'

In my activity, I have the following lines, after setting up the webView:

        // Register adjust bridge
        AdjustBridge.registerAndGetInstance(getApplication(), webView);

So far, so good.
Then on the web-app side, I have:

  const adjustAppToken = ********;
  const environment = AdjustConfig?.EnvironmentProduction;
  const adjustConfig = new AdjustConfig(adjustAppToken, environment);
  adjustConfig?.setLogLevel(AdjustConfig.LogLevelVerbose);

  // Track app did launch
  if (platform === 'ios') {
    Adjust.appDidLaunch(adjustConfig); // iOS
  }

  if (platform === 'android') {
    Adjust.onCreate(adjustConfig); // Android
  }

However, when I now check and debug my webview_bridge.js file (on the web-app side, where I handle the connection), both Adjust and AdjustConfig are undefined when checking them in the Chrome devtools console.
Only AdjustBridge returns an object with methods.
So it can't create a config, and it can't execute Adjust.onCreate.

I have checked the debugger, and it does have AdjustBridge, and I can call AdjustBridge.onCreate, but creating the config still doesn't work, as AdjustConfig is an undefined object.
So in short, Adjust never initialises properly.

Since Android SDK 4.33.0, the requires javascript files are supposedly embedded in the JAR itself, so I suppose I don't need to add them to the HTML document either right? Also, since it does seem to recognise AdjustBridge as an object with methods, it would seem the setup is done correctly.

What am I missing?
Or are there still bugs with the embedded javascript files?

Thanks.
Wes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant