Description:
I am trying to integrate OneSignal to my android app after successfully integrating it to iOS with no problems. I have added android platform to my app in my OneSignal account and gone through all the steps. However, when I run the app, it just fails to get the parameters and returns userid = null, pushtoken is not null, permissionStatus.enabled = true, subscriptionStatus.subscribed = false. I have literally tried everything since 3 days but with no luck. It doesn't event recognize in the website that any device has requested but got an error. I have tried using simulators and real devices but it never worked. I have also tried to go to the link its trying to access through the computers browser and it gets the json data.
Environment
Android Studio 3.4.2 (Windows 10)
Android Studio 3.5.1 (Mac OS Mojave 10.14.6)
Pixel 3 XL Simulator running (Android 9, API 28)
Pixel 2 XL Simulator running (Android 8.1, API 27)
Huawei Honor real device running (Android 7.0, API 24)
OneSignal.sdktype = native
OneSignal.VERSION = 031104
Steps to Reproduce Issue:
Code
public class ApplicationClass extends Application {
private static Context context;
public static Context getContext() {
return context;
}
@Override
public void onCreate() {
super.onCreate();
context = getApplicationContext();
// OneSignal Initialization
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.NONE);
OneSignal.startInit(this).inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification).unsubscribeWhenNotificationsAreDisabled(true)
.init();
}
}
OneSignal Logs
2019-10-06 12:15:11.498 30972-31049/com.mtm.edrequests W/OneSignal: OneSignalRestClient: null Error thrown from network stack.
java.net.SocketTimeoutException: failed to connect to onesignal.com/2606:4700::6810:d720 (port 443) from /fec0::1cb6:8803:6c1:556 (port 42418) after 60000ms
at libcore.io.IoBridge.connectErrno(IoBridge.java:185)
at libcore.io.IoBridge.connect(IoBridge.java:129)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:137)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
at java.net.Socket.connect(Socket.java:621)
at com.android.okhttp.internal.Platform.connectSocket(Platform.java:145)
at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:141)
at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:538)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:26)
at com.onesignal.OneSignalRestClient.startHTTPConnection(OneSignalRestClient.java:177)
at com.onesignal.OneSignalRestClient.access$100(OneSignalRestClient.java:44)
at com.onesignal.OneSignalRestClient$4.run(OneSignalRestClient.java:108)
at java.lang.Thread.run(Thread.java:764)
2019-10-06 12:15:11.500 30972-31057/com.mtm.edrequests I/OneSignal: Failed to get Android parameters, trying again in 40 seconds.
2019-10-06 12:15:51.504 30972-31057/com.mtm.edrequests D/OneSignal: Starting request to get Android parameters.
JSON Data
"chnl_lst":[],"outcomes":{"direct":{"enabled":false},"indirect":{"notification_attribution":{"minutes_since_displayed":1440,"limit":10},"enabled":false},"unattributed":{"enabled":false}}}
Howdy,
This sounds like you're having a network issue. Can you try on a different network? What country are you located in?
I am located in Egypt. I found the problem but I’m unable to resolve. The problem is, if I go to my browser and try going to https://onesignal.com, it is just blocked. However if I try to go to https://app.onesignal.com it works fine and because the OneSignal API uses https://onesignal.com/.., it just gets blocked here. I tried changing networks and using LTE but the issue persists. I just need a way to change the BASE_URL of the api from https://onesignal.com/ TO https://app.onesignal.com/
Egypt is blocking OneSignal. We are looking into how best to communicate with Egypt on how best to resolve this issue. If you want to reach out to your ISP and let them know they should unblock OneSignal, that would be helpful.
I tried contacting the ISP but they keep saying that it is not blocked. I will keep trying to contact them to hopefully get a solution to this.
@mtm19 ,
Okay. Please update the issue when possible
@rgomezp
I tried contacting all the ISPs with no positive results. They are all saying nothing is blocked though the site is still not working unless i access app.onesignal.com. So the only way I can think of now is updating the OneSignal SDK for iOS and Android to have the option of changing the BASE_URL from “https://onesignal.com/...” to “https://app.onesignal.com/..” . If you could do something about this that would be much appreciated as my project has been delayed for about 2 weeks because of this issue.
Not sure if that would help, but at least in my case, in a new browser session when I go to https://onesignal.com and get an SSL error, if I then visit https://app.onesignal.com which loads just fine, it solves the problem with https://onesignal.com and I no longer get the SSL error for as long as the session lives.
Hi everyone, unfortunately, this is something up to the ISP. I would encourage you to try to pressure them to unblock OneSignal. However, this isn't really an issue with the SDK so I will be closing the issue. Hopefully, this gets resolved soon
@rgomezp A workaround could be communicating over a subdomain like api.onesignal.com instead of the naked domain. It seems to be working without any issues so far on TE Data. Would it be possible to do this in the Android SDK?
I am from Egypt and I have the same problem any one find any Solution ?
I'm facing the same problem from Egypt
Please contact your ISP
Any update on that issue please, we still have that problem in Egypt, as tested with We, Etisalat, Vodafone, currently all have that issue
There is update to that issue please? Egypt's customers are highly affected
@rgomezp Any updates about this issue. We are still facing it.