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

userid is null #531

Closed
fatemeh2sh opened this issue May 10, 2018 · 10 comments
Closed

userid is null #531

fatemeh2sh opened this issue May 10, 2018 · 10 comments

Comments

@fatemeh2sh
Copy link

fatemeh2sh commented May 10, 2018

i have problem with userid in oneSignal.

OSPermissionSubscriptionState status = OneSignal.getPermissionSubscriptionState();
String userID = status.getSubscriptionStatus().getUserId();
boolean isSubscribed = status.getSubscriptionStatus().getSubscribed();

return userID to null in some phone
this is json
{
"permissionStatus": {
"enabled": true
},
"subscriptionStatus": {
"userId":null,
"pushToken": null,
"userSubscriptionSetting": false,
"subscribed": true
},
"emailSubscriptionStatus": {
"emailUserId": null,
"emailAddress": null,
"subscribed": false
}
}

@jkasten2
Copy link
Member

@fatemeh2sh If getUserId() is null you can call addSubscriptionObserver to setup a callback that will fire when any subscription property changes. You can then check if getTo().getUserId() is not null when this fires.

@fatemeh2sh
Copy link
Author

fatemeh2sh commented May 12, 2018

@jkasten2 i use in code

@Override
   public void onOSSubscriptionChanged(OSSubscriptionStateChanges stateChanges) {

      if (!stateChanges.getFrom().getSubscribed() &&
              stateChanges.getTo().getSubscribed()) {
         new AlertDialog.Builder(this)
                 .setMessage("You've successfully subscribed to push notifications!")
                 .show();
         // get player ID
         stateChanges.getTo().getUserId();
      }

      Log.i("Debug", "onOSPermissionChanged: " + stateChanges);
   }

but userId return null. why userid return null??

get error:

OneSignalRestClient: null Error thrown from network stack. 
javax.net.ssl.SSLHandshakeException: Handshake failed
    at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:392)
    at com.android.okhttp.Connection.upgradeToTls(Connection.java:1285)
    at com.android.okhttp.Connection.connect(Connection.java:1197)
    at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:392)
    at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:295)
    at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
    at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
    at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
    at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
    at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
    at com.onesignal.OneSignalRestClient.startHTTPConnection(OneSignalRestClient.java:146)
    at com.onesignal.OneSignalRestClient.access$100(OneSignalRestClient.java:38)
    at com.onesignal.OneSignalRestClient$4.run(OneSignalRestClient.java:94)
    at java.lang.Thread.run(Thread.java:818)
 Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xaec24200: Failure in SSL library, usually a protocol error
    error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (external/openssl/ssl/s23_clnt.c:740 0xaf056679:0x00000000)
    at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
    at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:320)
      ... 13 more

@jkasten2
Copy link
Member

@fatemeh2sh This javax.net.ssl.SSLHandshakeException: Handshake failed error means you device could not connect to onesignal.com. I recommend trying to opening a browser on the device to onesignal.com and make sure it loads. Also check to make sure your router, firewall, VPN, or proxy you maybe using isn't blocking onesignal.com in anyway.

@fatemeh2sh
Copy link
Author

@jkasten2 i did, i opened browser and load onesignal.com .
also i check vpn , proxy, but vpn,proxy were off. i dont know what is problem???

@jkasten2
Copy link
Member

jkasten2 commented May 16, 2018

@fatemeh2sh Could provide a few more details.

  1. Android versions you have tested
  2. Device models you have tests.
  3. Same error on both cell and WiFi connections?

The issue seems to be the device is trying to use an unsupported version of SSL. okhttp does have so more detail on this as well. square/okhttp#1628

Google has made a number of changes in Android 5. Some details here too
https://developer.android.com/about/versions/android-5.0-changes#ssl

@fatemeh2sh
Copy link
Author

fatemeh2sh commented May 23, 2018

@jkasten2 hi , my phone is glaxay note 3, with android 5.

@jkasten2
Copy link
Member

@fatemeh2sh Thanks for the device info. Have you tested on any other devices? Can you test on an emulator as well? Are you seeing this issue on both WiFi and a cell 3g/4g connection?

@fatemeh2sh
Copy link
Author

fatemeh2sh commented May 30, 2018

@jkasten2 i tested on emulator with android 5 and return userId correctly,
but in galaxy note 3 issue on both wifi and cell 3g/4g return userId null and show sslHandkShake.
but same galaxy note 3 change SIM CARD with same wife then return userId correctly.
What do you think?

@jkasten2
Copy link
Member

@fatemeh2sh I recommend making sure the date and time is correct on the device as this can cause SSL errors. If that is not the issue then it must be an issue with the your cell provider or ISP blocking or malforming the SSL handshake

@jkasten2
Copy link
Member

Closing due to inactivity, please provide more details if you believe the above isn't the case. Thanks.

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

2 participants