// Path: AccGeofences/app/src/main/java/com/accengage/samples/geofences/activities/MainActivity.java
// public class MainActivity extends AppCompatActivity {
//     private static final int LOCATION_REQUEST = 1;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_main);
//         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
// 
//         TextView mainTextView = (TextView) findViewById(R.id.textView);
//         mainTextView.setText(Html.fromHtml(getString(R.string.main_textview)));
//         mainTextView.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 Intent intent = new Intent(Intent.ACTION_VIEW);
//                 intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.lexa.fakegps"));
//                 startActivity(intent);
//             }
//         });
// 
//         //Request location permission for geolocation/geofencing features
//         if (ContextCompat.checkSelfPermission(this,
//                 android.Manifest.permission.ACCESS_FINE_LOCATION)
//                 != PackageManager.PERMISSION_GRANTED) {
// 
//             ActivityCompat.requestPermissions(this,
//                     new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
//                     LOCATION_REQUEST);
//         }
// 
//         Button button = (Button) findViewById(R.id.btn_view_geofences);
//         button.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 Intent intent = new Intent(MainActivity.this, DBViewerActivity.class);
//                 startActivity(intent);
//             }
//         });
// 
//         FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.floatingActionButton);
//         fab.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 Intent intent = new Intent(MainActivity.this, GeofenceTrackingActivity.class);
//                 startActivity(intent);
//             }
//         });
//     }
// }


import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import android.util.Log;
import com.accengage.samples.geofences.activities.MainActivity;
import com.ad4screen.sdk.Constants;
import java.util.Arrays;
package com.accengage.samples.geofences;





public class GeofenceReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();
        Bundle geofenceData = bundle.getBundle(Constants.EXTRA_GEOFENCE_PAYLOAD);

        if (geofenceData != null) {
            //Retrieve ids of geofences triggered :
            String[] geofencesIds = geofenceData.getStringArray("ids");
            //Retrieve transition code (1 == enter, 0 == exit)
            int transitionCode = geofenceData.getInt("transition");

            //Retrieve the geolocation that has triggered these geofences
            //(Note : you will have to parse it as a JSONObject)
            //Keys are : provider, latitude, longitude, altitude, accuracy, bearing, speed, time)
            String location = geofenceData.getString("triggeringLocation");
            if (location != null) {
                Log.d("GeofenceReceiver", "location: " + location);
            }

            //Do anything you want, here we will show a notification
// Path: AccGeofences/app/src/main/java/com/accengage/samples/geofences/activities/MainActivity.java
// public class MainActivity extends AppCompatActivity {
//     private static final int LOCATION_REQUEST = 1;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_main);
//         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
// 
//         TextView mainTextView = (TextView) findViewById(R.id.textView);
//         mainTextView.setText(Html.fromHtml(getString(R.string.main_textview)));
//         mainTextView.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 Intent intent = new Intent(Intent.ACTION_VIEW);
//                 intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.lexa.fakegps"));
//                 startActivity(intent);
//             }
//         });
// 
//         //Request location permission for geolocation/geofencing features
//         if (ContextCompat.checkSelfPermission(this,
//                 android.Manifest.permission.ACCESS_FINE_LOCATION)
//                 != PackageManager.PERMISSION_GRANTED) {
// 
//             ActivityCompat.requestPermissions(this,
//                     new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
//                     LOCATION_REQUEST);
//         }
// 
//         Button button = (Button) findViewById(R.id.btn_view_geofences);
//         button.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 Intent intent = new Intent(MainActivity.this, DBViewerActivity.class);
//                 startActivity(intent);
//             }
//         });
// 
//         FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.floatingActionButton);
//         fab.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 Intent intent = new Intent(MainActivity.this, GeofenceTrackingActivity.class);
//                 startActivity(intent);
//             }
//         });
//     }
// }


// Path: AccGeofences/app/src/main/java/com/accengage/samples/geofences/GeofenceReceiver.java
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import android.util.Log;
import com.accengage.samples.geofences.activities.MainActivity;
import com.ad4screen.sdk.Constants;
import java.util.Arrays;

package com.accengage.samples.geofences;





public class GeofenceReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();
        Bundle geofenceData = bundle.getBundle(Constants.EXTRA_GEOFENCE_PAYLOAD);

        if (geofenceData != null) {
            //Retrieve ids of geofences triggered :
            String[] geofencesIds = geofenceData.getStringArray("ids");
            //Retrieve transition code (1 == enter, 0 == exit)
            int transitionCode = geofenceData.getInt("transition");

            //Retrieve the geolocation that has triggered these geofences
            //(Note : you will have to parse it as a JSONObject)
            //Keys are : provider, latitude, longitude, altitude, accuracy, bearing, speed, time)
            String location = geofenceData.getString("triggeringLocation");
            if (location != null) {
                Log.d("GeofenceReceiver", "location: " + location);
            }

            //Do anything you want, here we will show a notification
            Intent notifIntent = new Intent(context, MainActivity.class);