]>
Commit | Line | Data |
---|---|---|
1 | package ro.ieval.fonbot; | |
2 | ||
3 | import org.eclipse.jdt.annotation.Nullable; | |
4 | ||
5 | import android.content.BroadcastReceiver; | |
6 | import android.content.Context; | |
7 | import android.content.Intent; | |
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 | * BroadcastReceiver that receives appwide local broadcasts. | |
30 | * | |
31 | * @author Marius Gavrilescu <marius@ieval.ro> | |
32 | */ | |
33 | public final class LocalBroadcastReceiver extends BroadcastReceiver { | |
34 | /** | |
35 | * Broadcast action: the poll alarm has fired, the app should poll the server | |
36 | */ | |
37 | public static final String ACTION_POLL_ALARM="ro.ieval.fonbot.SystemEventReceiver.ACTION_POLL_ALARM"; | |
38 | ||
39 | @Override | |
40 | public void onReceive(final @Nullable Context context, final @Nullable Intent intent) { | |
41 | if(context==null || intent==null) | |
42 | return; | |
43 | ||
44 | final String action=intent.getAction(); | |
45 | if(action.equals(LocalBroadcastReceiver.ACTION_POLL_ALARM)) | |
46 | Utils.pollServer(context); | |
47 | } | |
48 | ||
49 | } |