/* * The CroudTrip! application aims at revolutionizing the car-ride-sharing market with its easy, * user-friendly and highly automated way of organizing shared Trips. Copyright (C) 2015 Nazeeh Ammari, * Philipp Eichhorn, Ricarda Hohn, Vanessa Lange, Alexander Popp, Frederik Simon, Michael Weber * This program is free software: you can redistribute it and/or modify it under the terms of the GNU * Affero General Public License as published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public License along with this program. * If not, see http://www.gnu.org/licenses/. */ package org.croudtrip.gcm; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.support.v4.content.WakefulBroadcastReceiver; import android.widget.Toast; import com.google.android.gms.gcm.GoogleCloudMessaging; import org.croudtrip.R; import org.croudtrip.account.AccountManager; import org.croudtrip.api.TripsResource; import org.croudtrip.api.gcm.GcmConstants; import org.croudtrip.api.trips.JoinTripRequest; import org.croudtrip.api.trips.JoinTripRequestUpdate; import retrofit.RequestInterceptor; import retrofit.RestAdapter; import rx.functions.Action1; import timber.log.Timber; public class GcmBroadcastReceiver extends WakefulBroadcastReceiver{ @Override public void onReceive(final Context context, Intent intent) { ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName()); // Start the service, keeping the device awake while it is launching. startWakefulService(context, (intent.setComponent(comp))); setResultCode(Activity.RESULT_OK); } }