Last updated:
0 purchases
geofence
geofence #
This plugin help get geofence notification
Getting Started #
Android #
Add the following lines to your AndroidManifest.xml to register the background service for geofencing:
<receiver android:name="com.webstersys.geofence.geofence.GeofenceBroadcastReceiver"
android:enabled="true"
android:exported="true" />
<service android:name="com.webstersys.geofence.geofence.GeofenceTransitionsJobIntentService" android:enabled="true" android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE"/>
<receiver android:name="com.webstersys.geofence.BootDeviceReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
copied to clipboard
Also request the correct permissions for geofencing:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
copied to clipboard
Finally, create either Application.kt or Application.java in the same directory as MainActivity.
For Application.kt, use the following:
class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate();
GeofenceTransitionsJobIntentService.setPluginRegistrant(this)
}
override fun registerWith(registry: PluginRegistry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
copied to clipboard
For Application.java, use the following:
public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
GeofenceTransitionsJobIntentService.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
copied to clipboard
Which must also be referenced in AndroidManifest.xml:
<application
android:name=".Application" />
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.