]> iEval git - fonbot.git/blame_incremental - src/ro/ieval/fonbot/FonBotApplication.java
Upgrade to the latest server protocol.
[fonbot.git] / src / ro / ieval / fonbot / FonBotApplication.java
... / ...
CommitLineData
1package ro.ieval.fonbot;
2
3import android.app.Application;
4import android.content.Intent;
5import android.telephony.PhoneStateListener;
6import android.telephony.TelephonyManager;
7
8import com.google.android.gcm.GCMRegistrar;
9
10/*
11 * Copyright © 2013 Marius Gavrilescu
12 *
13 * This file is part of FonBot.
14 *
15 * FonBot is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * FonBot is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with FonBot. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29/**
30 * The {@link Application} class of FonBot. Registers the device with GCM, starts the TTS service and keeps global state.
31 *
32 * @author Marius Gavrilescu <marius@ieval.ro>
33 */
34public final class FonBotApplication extends Application {
35 /**
36 * iEval GCM sender id
37 */
38 public static final String GCM_SENDER_ID = "379674287523";
39 /**
40 * The one instance of FonBotApplication
41 */
42 public static FonBotApplication instance=null;
43 /**
44 * The GCM registration ID
45 */
46 public String regID=null;
47
48 @Override
49 public void onCreate() {
50 super.onCreate();
51 //GCMRegistrar.checkDevice(this);
52 regID=GCMRegistrar.getRegistrationId(this);
53 if("".equals(regID))
54 GCMRegistrar.register(this, GCM_SENDER_ID);
55
56 final TelephonyManager tman=(TelephonyManager) getSystemService(TELEPHONY_SERVICE);
57 tman.listen(new FonBotPhoneStateListener(this), PhoneStateListener.LISTEN_CALL_STATE);
58 instance=this;
59
60 new PollServerAsyncTask(this).execute();
61
62 startService(new Intent(this, FonBotMainService.class));
63
64// Thread.setDefaultUncaughtExceptionHandler(new RemoteCrashdumpHandler(this));
65 }
66}
This page took 0.015293 seconds and 4 git commands to generate.