]>
Commit | Line | Data |
---|---|---|
8dfb76c9 MG |
1 | package ro.ieval.fonbot; |
2 | ||
3 | import org.eclipse.jdt.annotation.Nullable; | |
4 | ||
5 | import android.content.Context; | |
6 | import android.content.Intent; | |
8dfb76c9 MG |
7 | import com.google.android.gcm.GCMBaseIntentService; |
8 | ||
9 | /* | |
10 | * Copyright © 2013 Marius Gavrilescu | |
11 | * | |
12 | * This file is part of FonBot. | |
13 | * | |
14 | * FonBot is free software: you can redistribute it and/or modify | |
15 | * it under the terms of the GNU General Public License as published by | |
16 | * the Free Software Foundation, either version 3 of the License, or | |
17 | * (at your option) any later version. | |
18 | * | |
19 | * FonBot is distributed in the hope that it will be useful, | |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | * GNU General Public License for more details. | |
23 | * | |
24 | * You should have received a copy of the GNU General Public License | |
25 | * along with FonBot. If not, see <http://www.gnu.org/licenses/>. | |
26 | */ | |
27 | ||
28 | /** | |
29 | * Service that responds to GCM events | |
30 | * | |
31 | * @author Marius Gavrilescu <marius@ieval.ro> | |
32 | */ | |
33 | public class GCMIntentService extends GCMBaseIntentService { | |
8dfb76c9 MG |
34 | /** |
35 | * Constructs a GCMIntentService with the iEval sender id | |
36 | */ | |
37 | public GCMIntentService() { | |
38 | super(FonBotApplication.GCM_SENDER_ID); | |
39 | } | |
40 | ||
41 | @Override | |
42 | protected void onError(@Nullable final Context context, @Nullable final String errID) { | |
43 | //TODO error handling here | |
44 | } | |
45 | ||
46 | @Override | |
47 | protected void onMessage(@Nullable final Context context, @Nullable final Intent intent) { | |
a97d31fb MG |
48 | if(context==null) |
49 | return; | |
50 | ||
2e5049c9 | 51 | Utils.pollServer(context); |
8dfb76c9 MG |
52 | } |
53 | ||
54 | @Override | |
55 | protected void onRegistered(@Nullable final Context context, @Nullable final String regID) { | |
8bfdcf7a | 56 | //do nothing |
8dfb76c9 MG |
57 | } |
58 | ||
59 | @Override | |
60 | protected void onUnregistered(@Nullable final Context context, @Nullable final String regID) { | |
61 | //do nothing | |
62 | } | |
63 | } |