1 package ro
.ieval
.fonbot
;
3 import android
.app
.Application
;
4 import android
.content
.Intent
;
5 import android
.telephony
.PhoneStateListener
;
6 import android
.telephony
.TelephonyManager
;
8 import com
.google
.android
.gcm
.GCMRegistrar
;
11 * Copyright © 2013 Marius Gavrilescu
13 * This file is part of FonBot.
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.
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.
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/>.
30 * The {@link Application} class of FonBot. Registers the device with GCM, starts the TTS service and keeps global state.
32 * @author Marius Gavrilescu <marius@ieval.ro>
34 public final class FonBotApplication
extends Application
{
38 public static final String GCM_SENDER_ID
= "379674287523";
40 * The one instance of FonBotApplication
42 public static FonBotApplication instance
=null;
44 * The GCM registration ID
46 public String regID
=null;
49 public void onCreate() {
51 //GCMRegistrar.checkDevice(this);
52 regID
=GCMRegistrar
.getRegistrationId(this);
54 GCMRegistrar
.register(this, GCM_SENDER_ID
);
56 final TelephonyManager tman
=(TelephonyManager
) getSystemService(TELEPHONY_SERVICE
);
57 tman
.listen(new FonBotPhoneStateListener(this), PhoneStateListener
.LISTEN_CALL_STATE
);
60 new PollServerAsyncTask(this).execute();
62 startService(new Intent(this, FonBotMainService
.class));
64 // Thread.setDefaultUncaughtExceptionHandler(new RemoteCrashdumpHandler(this));