Amab
8fd41782ad
## What changes were proposed in this pull request? * Update to Android API 34 (Android 14) * Remove Firebase Analytics ## How was this patch tested? Manually. Reviewed-on: #420 Co-authored-by: Amab <juanmi1982@gmail.com> Co-committed-by: Amab <juanmi1982@gmail.com>
57 lines
2.0 KiB
Java
57 lines
2.0 KiB
Java
/*
|
|
* This file is part of SWADroid.
|
|
*
|
|
* Copyright (C) 2010 Juan Miguel Boyero Corral <juanmi1982@gmail.com>
|
|
*
|
|
* SWADroid is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* SWADroid 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with SWADroid. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package es.ugr.swad.swadroid.sync;
|
|
|
|
import android.app.PendingIntent;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.ContentResolver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
|
|
import es.ugr.swad.swadroid.Constants;
|
|
|
|
/**
|
|
* Class for launch a periodic sync request
|
|
*
|
|
* @author Juan Miguel Boyero Corral <juanmi1982@gmail.com>
|
|
*/
|
|
public final class PeriodicSyncReceiver extends BroadcastReceiver {
|
|
|
|
private static Intent createIntent(Context context, String authority) {
|
|
Intent intent = new Intent(context, PeriodicSyncReceiver.class);
|
|
intent.putExtra(Constants.AUTHORITY, authority);
|
|
return intent;
|
|
}
|
|
|
|
public static PendingIntent createPendingIntent(Context context, String authority, Bundle extras) {
|
|
int requestCode = 0;
|
|
Intent intent = createIntent(context, authority);
|
|
int flags = PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE;
|
|
return PendingIntent.getBroadcast(context, requestCode, intent, flags);
|
|
}
|
|
|
|
@Override
|
|
public void onReceive(Context context, Intent intent) {
|
|
String authority = intent.getStringExtra(Constants.AUTHORITY);
|
|
|
|
ContentResolver.requestSync(null, authority, new Bundle());
|
|
}
|
|
}
|