File tree 1 file changed +9
-3
lines changed
presentation/src/main/java/com/jorge/boats/xkcd/task
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 5
5
import android .app .PendingIntent ;
6
6
import android .content .Context ;
7
7
import android .content .Intent ;
8
+ import android .support .annotation .NonNull ;
8
9
import android .support .annotation .Nullable ;
9
10
import android .support .v4 .app .NotificationCompat ;
10
11
@@ -21,10 +22,15 @@ public class UserRetentionGcmTaskService extends GcmTaskService {
21
22
22
23
@ Override
23
24
public int onRunTask (final @ Nullable TaskParams taskParams ) {
24
- if (System .currentTimeMillis () - Long .parseLong (P .lastOpenedEpoch .get ()) > APP_IGNORED_LIMIT_MILLISECONDS ) {
25
- showReengageNotification ();
25
+ try {
26
+ if (System .currentTimeMillis () - Long .parseLong (P .lastOpenedEpoch .get ()) > APP_IGNORED_LIMIT_MILLISECONDS ) {
27
+ showReengageNotification ();
28
+ }
29
+ return GcmNetworkManager .RESULT_SUCCESS ;
30
+ } catch (final @ NonNull NumberFormatException e ) {
31
+ //The preference has not been written yet, so just reschedule and move on
32
+ return GcmNetworkManager .RESULT_RESCHEDULE ;
26
33
}
27
- return GcmNetworkManager .RESULT_SUCCESS ;
28
34
}
29
35
30
36
private void showReengageNotification () {
You can’t perform that action at this time.
0 commit comments