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

The SDK crashes when starting as a Instant App #199

Open
4 tasks done
Lisomatrix opened this issue Nov 21, 2024 · 1 comment
Open
4 tasks done

The SDK crashes when starting as a Instant App #199

Lisomatrix opened this issue Nov 21, 2024 · 1 comment
Labels
enhancement New feature or request evergreen

Comments

@Lisomatrix
Copy link

Checklist

  • I have read the contributing guidelines
  • I have determined whether this bug is also reproducible in a vanilla Android project
  • If possible, I've reproduced the issue using the master branch or latest release of this package.
  • This issue hasn't been addressed in an existing GitHub issue or pull request.

Description

The Klaviyo.initialize() call crashes due to missing permissions that are not available when running an instant app. This can be easily reproduced on Android Studio when running the application as an instant app.
In the android documentation (https://developer.android.com/topic/google-play-instant/getting-started/instant-enabled-app-bundle#configure-permissions), it says that we cannot use the permission CHANGE_NETWORK_STATE that is currently being used on the core module.

Stack Trace:
...
java.lang.SecurityException: x.x.x was not granted either of these permissions:android.permission.CHANGE_NETWORK_STATE,android.permission.WRITE_SETTINGS.
...

Caused by: java.lang.SecurityException: pt.napps.shop was not granted either of these permissions:android.permission.CHANGE_NETWORK_STATE,android.permission.WRITE_SETTINGS.
...
at com.klaviyo.core.networking.KlaviyoNetworkMonitor.initializeNetworkListener(KlaviyoNetworkMonitor.kt:120)
at com.klaviyo.core.networking.KlaviyoNetworkMonitor.onNetworkChange(KlaviyoNetworkMonitor.kt:54)
at com.klaviyo.analytics.networking.KlaviyoApiClient.startService(KlaviyoApiClient.kt:50)
at com.klaviyo.analytics.Klaviyo$initialize$1.invoke(Klaviyo.kt:69)
at com.klaviyo.analytics.Klaviyo$initialize$1.invoke(Klaviyo.kt:55)
at com.klaviyo.core.KlaviyoExceptionKt.safeCall(KlaviyoException.kt:23)
at com.klaviyo.core.KlaviyoExceptionKt.safeCall$default(KlaviyoException.kt:19)
at com.klaviyo.analytics.Klaviyo.initialize(Klaviyo.kt:55)
...

Expected behavior

For the SDK, to be able to run on instant apps.

Actual behavior

Currently, the SDK fails to initialize on instant apps.

Steps to reproduce

1. Create new project or reuse existing
2. Follow steps to run app as instant app https://developer.android.com/topic/google-play-instant/getting-started/instant-enabled-app-bundle#test-from-studio
3. See stack trace

The Klaviyo Android SDK version information

3.0.0

Device Information

Pixel 8 Pro API 35

Android Studio Version

Android Studio Ladybug | 2024.2.1 Beta 1

Android API Level

API Level 35

@Lisomatrix Lisomatrix added the bug Something isn't working label Nov 21, 2024
@jordan-griffin
Copy link
Contributor

Hey, thanks for reporting this issue.
We currently do not support instant apps through our SDK offerings. Android instant apps have their own set of allowed permissions that are more restrictive than standard app permissions which you can view in the developer documentation here. Since we utilize some of these permissions we're not going to be compatible with instant apps without significant development work.

We will keep this issue open as a feature request and continue to consider its priority in the future.

@jordan-griffin jordan-griffin added enhancement New feature or request evergreen and removed bug Something isn't working labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request evergreen
Projects
None yet
Development

No branches or pull requests

2 participants