Skip to content

Instantly share code, notes, and snippets.

View christocracy's full-sized avatar

Chris Scott christocracy

View GitHub Profile
@christocracy
christocracy / bundle-install.sh
Created April 8, 2024 14:35
React Native Bundle Install
#!/bin/bash
##
# Use the script to install a pre-bundled RN app which won't require the development server
#
# Usage
# ---------------------------------
# $ ./bundle-install.sh
#
package com.transistorsoft.cordova.bggeo;
import org.greenrobot.eventbus.Subscribe;
import org.json.JSONException;
import org.json.JSONObject;
import com.transistorsoft.locationmanager.adapter.BackgroundGeolocation;
import com.transistorsoft.locationmanager.adapter.callback.TSLocationCallback;
import com.transistorsoft.locationmanager.event.ActivityChangeEvent;
import com.transistorsoft.locationmanager.event.GeofenceEvent;
/**
* How to implement cordova-background-geolocation with Ionic 2 / 3
* @see https://github.com/transistorsoft/cordova-background-geolocation-lt
* @author Chris Scott, Transistor Software <chris@transistorsoft.com>
*/
import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';
/**
* flutter_background_geolocation Hello World
* https://github.com/transistorsoft/flutter_background_geolocation
*/
import 'package:flutter/material.dart';
import 'package:flutter_background_geolocation/flutter_background_geolocation.dart' as bg;
////
// For pretty-printing location JSON. Not a requirement of flutter_background_geolocation
@christocracy
christocracy / BackgroundGeolocation-Ionic2.js
Last active September 6, 2018 15:31
Simple Cordova Background Geolocation Implementation for Ionic 2 / 3
/**
* How to implement cordova-background-geolocation with Ionic 2 / 3
* https://github.com/transistorsoft/cordova-background-geolocation-lt
* Chris Scott, Transistor Software <chris@transistorsoft.com>
*/
import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';
@christocracy
christocracy / geofencing.js
Last active October 11, 2016 06:02
Background Geolocation Geofencing
// Listen for geofence events.
bgGeo.on('geofence', function(params) {
console.log('- Geofence event: ', params.identifier);
});
// Add a geofence
bgGeo.addGeofences({
identifier: 'HOME',
radius: 200,
latitude: 45.51818958022214,
longitude: -73.61409989192487,
@christocracy
christocracy / scheduler-splash.js
Last active October 11, 2016 05:39
Background Geolocation Scheduler
bgGeo.configure({
startOnBoot: true, // Scheduler will start when device is rebooted.
schedule: [
'2,4 6:00-19:00', // Mon,Wed: 6:00am-7:00pm
'3 11:00-14:00', // Tue: 11:00am-2:00pm
'6 6:00-7:00', // Fri: 6:00am-7:00am
'6 8:00-19:00', // Fri: 8:00am-7:00pm
'2-6 20:00-21:00' // Mon-Fri: 8:00pm-9:00pm
]
}, function() {
@christocracy
christocracy / scheduler.js
Last active April 30, 2016 13:33
Sample of new Background Geolocation scheduling schema.
bgGeo.configure({
.
.
.
schedule: [
'1 17:30-21:00', // Sunday: 5:30-9:00
'2-6 9:00-17:00', // Mon-Fri: 9am to 5pm
'2,4,6 20:00-12:00',// Mon, Web, Fri: 8pm to midnight (next day)
'7 10:00-19:00' // Sun: 10am-7pm
]
@christocracy
christocracy / LifecycleEventLIstener.java
Last active June 24, 2022 07:38
Listening to React-Native life-cycle events in your custom Views or Modules
public class MyView extends SimpleViewManager<MapView> {
public static final String TAG = "MyView";
@Override
public String getName() {
return TAG;
}
@Override
protected MapView createViewInstance(ThemedReactContext context) {
{
"device": {
"available": true,
"platform": "Android",
"version": "5.1.1",
"uuid": "125c663531f37f55",
"cordova": "4.1.1",
"model": "Nexus 5",
"manufacturer": "LGE"
},