Skip to content

[Bug]: problem appears on last version oneSignal Android com.onesignal:OneSignal:5.1.31 #2291

Description

@tosuccesspractice

What happened?

On the last version com.onesignal:OneSignal:5.1.31
Crash appears on crashlytics :
Fatal Exception: java.lang.OutOfMemoryError
pthread_create (1040KB stack) failed: Try again
java.lang.Thread.nativeCreate (Thread.java)

com.onesignal.user.internal.PushSubscription.optIn (PushSubscription.kt:27)

When trying to do OneSignal.getUser().getPushSubscription().optIn(); on function onPushSubscriptionChange

Complete code :

@Override
public void onPushSubscriptionChange(@NonNull PushSubscriptionChangedState pushSubscriptionChangedState) {
        IPushSubscription pushSubscription = OneSignal.getUser().getPushSubscription();
        if(pushSubscription.getId() != null && pushSubscription.getId() != ""){
            if(!playerIdSended && userId != null && userId != ""){
                LoginActivity.updateOneSignalIds(userId, accessToken, pushSubscription.getId(), 10);
            }
        }
        else{
            OneSignal.getUser().getPushSubscription().optIn();
        }
}

Steps to reproduce?

import com.onesignal:OneSignal:5.1.31
public class MyApplication extends Application implements IPushSubscriptionObserver {
    @Override
    public void onCreate() {
        super.onCreate();
..
       OneSignal.initWithContext(this);
        String ONESIGNAL_APP_ID = "xxxxxx";
        OneSignal.initWithContext(this, ONESIGNAL_APP_ID);
...
}

What did you expect to happen?

I expect no crash caused by oneSignal

OneSignal Android SDK version

5.1.31

Android version

14

Specific Android models

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions