Skip to content

[question]: [question]: OneSignal API only works through VPN – SDK can’t get player ID on local network #1083

@fahad-islam1

Description

@fahad-islam1

How can we help?

Summary

I’m integrating onesignal_flutter in a Flutter Android app.
On my current network (Pakistan ISP), the OneSignal API is not reachable unless I use a VPN. Because of this the Flutter SDK never gets a OneSignal user ID / subscription ID, and push notifications don’t work.

When I turn on VPN on the same device, everything starts working and the IDs are populated correctly.

I’m trying to understand if there is anything I can configure on the OneSignal side or SDK side to make this work without requiring VPN for end users.


Environment

  • SDK: onesignal_flutter: ^5.3.4
  • Platform: Android
  • Device: TECNO CM6 (Android 15)
  • Flutter: stable (Android app)
  • Location: Pakistan
  • ISP / Carrier: Jazz (also reproduced on my home Wi-Fi that uses the same ISP)

What I’m seeing

1. Flutter SDK behavior (without VPN)

  • OneSignal.initialize(APP_ID) is called.

  • OneSignal.Notifications.requestPermission(true) is called.

  • When I read the values:

    final userId = await OneSignal.User.getOnesignalId();
    final pushSub = OneSignal.User.pushSubscription;

I get:

userId → null

pushSub.id → null or empty

pushSub.token → empty

pushSub.optedIn → sometimes true, but no IDs
Same app with VPN ON (same device)

As soon as I enable VPN on the phone:

OneSignal.User.getOnesignalId() returns a proper ID.

pushSub.id and pushSub.token are populated.

Push notifications work as expected.

  1. Direct API test from browser

On the same network (without VPN), from my PC browser:

Opening https://api.onesignal.com/apps results in:

This site can’t be reached
api.onesignal.com unexpectedly closed the connection
ERR_CONNECTION_CLOSED

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions