Fixes an issue with services

This commit is contained in:
stom79 2017-11-29 18:26:32 +01:00
parent 3f71a78c2e
commit 4dc40d3ee4
5 changed files with 10 additions and 7 deletions

View File

@ -50,7 +50,7 @@
<receiver android:name=".services.RestartLiveNotificationReceiver"
android:exported="false">
<intent-filter>
<action android:name="RestartStreamingService" />
<action android:name="RestartLiveNotificationService" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

View File

@ -208,7 +208,7 @@ public class LiveNotificationService extends Service {
if( !restartCalled ) {
restartCalled = true;
SystemClock.sleep(60000);
sendBroadcast(new Intent("RestartStreamingService"));
sendBroadcast(new Intent("RestartLiveNotificationService"));
stopSelf();
}
}
@ -230,8 +230,8 @@ public class LiveNotificationService extends Service {
httpsURLConnection.disconnect();
if( !restartCalled ) {
restartCalled = true;
SystemClock.sleep(10000);
sendBroadcast(new Intent("RestartStreamingService"));
SystemClock.sleep(5000);
sendBroadcast(new Intent("RestartLiveNotificationService"));
stopSelf();
}
}

View File

@ -109,7 +109,8 @@ public class StreamingFederatedTimelineService extends IntentService {
httpsURLConnection.setRequestProperty("Connection", "Keep-Alive");
httpsURLConnection.setRequestProperty("Keep-Alive", "header");
httpsURLConnection.setRequestProperty("Connection", "close");
httpsURLConnection.setSSLSocketFactory(new TLSSocketFactory());
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP)
httpsURLConnection.setSSLSocketFactory(new TLSSocketFactory());
httpsURLConnection.setRequestMethod("GET");
httpsURLConnection.setConnectTimeout(70000);
httpsURLConnection.setReadTimeout(70000);

View File

@ -108,7 +108,8 @@ public class StreamingLocalTimelineService extends IntentService {
httpsURLConnection.setRequestProperty("Connection", "Keep-Alive");
httpsURLConnection.setRequestProperty("Keep-Alive", "header");
httpsURLConnection.setRequestProperty("Connection", "close");
httpsURLConnection.setSSLSocketFactory(new TLSSocketFactory());
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP)
httpsURLConnection.setSSLSocketFactory(new TLSSocketFactory());
httpsURLConnection.setRequestMethod("GET");
httpsURLConnection.setConnectTimeout(70000);
httpsURLConnection.setReadTimeout(70000);

View File

@ -106,7 +106,8 @@ public class StreamingService extends IntentService {
httpsURLConnection.setRequestProperty("Connection", "Keep-Alive");
httpsURLConnection.setRequestProperty("Keep-Alive", "header");
httpsURLConnection.setRequestProperty("Connection", "close");
httpsURLConnection.setSSLSocketFactory(new TLSSocketFactory());
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP)
httpsURLConnection.setSSLSocketFactory(new TLSSocketFactory());
httpsURLConnection.setRequestMethod("GET");
httpsURLConnection.setConnectTimeout(70000);
httpsURLConnection.setReadTimeout(70000);