This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template | |
app = Flask(__name__) | |
@app.route("/") | |
def album(): | |
return render_template("album.html") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class App extends Application { | |
public static final String CHANNEL_ID = "channel 1"; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
createNotificationChannel(); | |
} | |
private void createNotificationChannel() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> | |
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> | |
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LocationService extends Service { | |
@Override | |
public IBinder onBind(Intent intent) { | |
return binder; | |
} | |
@Override | |
public int onStartCommand(Intent intent, int flags, int startId) { | |
Intent notificationIntent = new Intent(this, MapsActivity.class); | |
PendingIntent pendingIntent = PendingIntent.getActivity(this, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyBroadCastReceiver extends BroadcastReceiver { | |
private String audioFile; | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
GeofencingEvent geofencingEvent = GeofencingEvent.fromIntent(intent); | |
if (geofencingEvent.hasError()) { | |
String errorMessage = GeofenceStatusCodes.getStatusCodeString(geofencingEvent.getErrorCode()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private GeofencingRequest getGeofencingRequest() { | |
GeofencingRequest.Builder builder = new GeofencingRequest.Builder(); | |
builder.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER); | |
builder.addGeofences(geofenceList); | |
return builder.build(); | |
} | |
private PendingIntent getGeofencePendingIntent() { | |
// Reuse the PendingIntent if we already have it. | |
if (geofencePendingIntent != null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void addGeofence() { | |
geofencingClient.addGeofences(getGeofencingRequest(), getGeofencePendingIntent()) | |
.addOnSuccessListener(this, aVoid -> { | |
Toast.makeText(getApplicationContext() | |
, "Geofencing has started", Toast.LENGTH_SHORT).show(); | |
}) | |
.addOnFailureListener(this, e -> { | |
Toast.makeText(getApplicationContext() | |
, "Geofencing failed", Toast.LENGTH_SHORT).show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private List<Geofence> geofenceList = new ArrayList<>(); | |
private PendingIntent geofencePendingIntent; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_maps); | |
geofenceList.add(new Geofence.Builder() | |
// Set the request ID of the geofence. This is a string to identify this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation 'com.google.android.gms:play-services-maps:16.1.0' | |
implementation 'com.google.android.gms:play-services-location:17.0.0' | |
} | |
apply plugin: 'com.google.gms.google-services' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
classpath 'com.google.gms:google-services:4.3.3' |