Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
5867bbde
Commit
5867bbde
authored
Aug 18, 2017
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove keep-alive task service
parent
46e67112
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
54 deletions
+0
-54
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+0
-8
RocketChatWebSocketThread.java
...hat/rocket/android/service/RocketChatWebSocketThread.java
+0
-25
TaskService.java
...rc/main/java/chat/rocket/android/service/TaskService.java
+0
-21
No files found.
app/src/main/AndroidManifest.xml
View file @
5867bbde
...
...
@@ -70,14 +70,6 @@
</intent-filter>
</service>
<service
android:name=
".service.TaskService"
android:permission=
"com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"com.google.android.gms.gcm.ACTION_TASK_READY"
/>
</intent-filter>
</service>
<meta-data
android:name=
"io.fabric.ApiKey"
android:value=
"12ac6e94f850aaffcdff52001af77ca415d06a43"
/>
...
...
app/src/main/java/chat/rocket/android/service/RocketChatWebSocketThread.java
View file @
5867bbde
...
...
@@ -4,9 +4,6 @@ import android.content.Context;
import
android.os.Handler
;
import
android.os.HandlerThread
;
import
com.google.android.gms.gcm.GcmNetworkManager
;
import
com.google.android.gms.gcm.PeriodicTask
;
import
org.json.JSONObject
;
import
java.lang.reflect.Constructor
;
...
...
@@ -418,28 +415,6 @@ public class RocketChatWebSocketThread extends HandlerThread {
}
private
void
startHeartBeat
()
{
// This task is scheduled to guarantee that RocketChatService is still bound at the application
// process. This is necessary due to the way the keep-alive assertions are currently architectured.
// By doing those keep-alives periodically we try to ensure that we have the app alive
// if for some reason its process gets killed (for any reason).
// TODO: should set this at another point; we should specify a reasonable time-window.
// TODO: should check and handle the case Google Play Services isn't available.
// TODO: consider on using https://github.com/evernote/android-job for this as it allows much more
// customisation like running at exponential backoff and others. We should alos use it more
// extensively throughout the app on all the common tasks, like i.e. sending a message
GcmNetworkManager
gcmNetworkManager
=
GcmNetworkManager
.
getInstance
(
appContext
);
gcmNetworkManager
.
schedule
(
new
PeriodicTask
.
Builder
()
.
setRequiresCharging
(
false
)
.
setUpdateCurrent
(
true
)
.
setRequiredNetwork
(
com
.
google
.
android
.
gms
.
gcm
.
Task
.
NETWORK_STATE_ANY
)
.
setTag
(
TaskService
.
TAG_KEEP_ALIVE
)
.
setService
(
TaskService
.
class
)
.
setPeriod
(
30
)
.
setFlex
(
15
)
.
build
()
);
hearbeatDisposable
.
clear
();
hearbeatDisposable
.
add
(
heartbeat
(
HEARTBEAT_PERIOD_MS
)
...
...
app/src/main/java/chat/rocket/android/service/TaskService.java
deleted
100644 → 0
View file @
46e67112
package
chat
.
rocket
.
android
.
service
;
import
com.google.android.gms.gcm.GcmNetworkManager
;
import
com.google.android.gms.gcm.GcmTaskService
;
import
com.google.android.gms.gcm.TaskParams
;
public
class
TaskService
extends
GcmTaskService
{
public
static
final
String
TAG_KEEP_ALIVE
=
"TAG_KEEP_ALIVE"
;
@Override
public
int
onRunTask
(
TaskParams
taskParams
)
{
switch
(
taskParams
.
getTag
())
{
case
TAG_KEEP_ALIVE:
ConnectivityManager
.
getInstance
(
getApplicationContext
()).
keepAliveServer
();
return
GcmNetworkManager
.
RESULT_SUCCESS
;
default
:
return
GcmNetworkManager
.
RESULT_FAILURE
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment