Refactored extractions of server version from AccountManager through
[pub/Android/ownCloud.git] / src / com / owncloud / android / files / BootupBroadcastReceiver.java
1 /**
2 * ownCloud Android client application
3 *
4 * @author David A. Velasco
5 * Copyright (C) 2012 Bartek Przybylski
6 * Copyright (C) 2015 ownCloud Inc.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2,
10 * as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22 package com.owncloud.android.files;
23
24 import com.owncloud.android.lib.common.utils.Log_OC;
25 import com.owncloud.android.services.observer.FileObserverService;
26
27 import android.content.BroadcastReceiver;
28 import android.content.Context;
29 import android.content.Intent;
30
31
32 /**
33 * App-registered receiver catching the broadcast intent reporting that the system was
34 * just boot up.
35 */
36 public class BootupBroadcastReceiver extends BroadcastReceiver {
37
38 private static String TAG = BootupBroadcastReceiver.class.getSimpleName();
39
40 /**
41 * Receives broadcast intent reporting that the system was just boot up.
42 *
43 * Starts {@link FileObserverService} to enable observation of favourite files.
44 *
45 * @param context The context where the receiver is running.
46 * @param intent The intent received.
47 */
48 @Override
49 public void onReceive(Context context, Intent intent) {
50 if (!intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
51 Log_OC.wtf(TAG, "Incorrect action sent " + intent.getAction());
52 return;
53 }
54 Log_OC.d(TAG, "Starting file observer service...");
55 Intent initObservers = FileObserverService.makeInitIntent(context);
56 context.startService(initObservers);
57 }
58
59 }