Skip to content

Instantly share code, notes, and snippets.

View marchbold's full-sized avatar
🚲
making stuff...

Michael marchbold

🚲
making stuff...
View GitHub Profile
@marchbold
marchbold / distriqt.extension.cloudstorage.documentstore.events.as
Created July 29, 2016 00:53
Cloud container document updates using the Cloud Storage ANE
CloudStorage.service.documentStore.addEventListener( DocumentStoreEvent.UPDATE_START, updateStartHandler );
CloudStorage.service.documentStore.addEventListener( DocumentStoreEvent.UPDATE_END, updateEndHandler );
CloudStorage.service.documentStore.addEventListener( DocumentStoreEvent.FILES_DID_CHANGE, filesDidChangeHandler );
...
private function updateStartHandler( event:DocumentStoreEvent ):void
{
trace( "update started" );
}
@marchbold
marchbold / distriqt.extension.cloudstorage.documentstore.setup.as
Created July 29, 2016 00:47
Container initialisation using the Cloud Storage ANE
CloudStorage.service.documentStore.addEventListener( DocumentStoreEvent.INITIALISED, initialisedHandler );
CloudStorage.service.documentStore.setup(); // This will use the default / first container
...
private function ds_initialisedHandler( event:DocumentStoreEvent ):void
{
trace( "cloud container initialised" );
}
@marchbold
marchbold / distriqt.extension.bluetoothle.authorisation.as
Created July 16, 2016 08:11
Requesting user authorisation using the Bluetooth LE ANE
BluetoothLE.service.addEventListener( AuthorisationEvent.CHANGED, authorisationChangedHandler );
switch (BluetoothLE.service.authorisationStatus())
{
case AuthorisationStatus.AUTHORISED:
// The user has granted access to Bluetooth LE
break;
case AuthorisationStatus.NOT_DETERMINED:
case AuthorisationStatus.SHOULD_EXPLAIN:
@marchbold
marchbold / distriqt.extension.bluetoothle.infoAdditions.xml
Created July 16, 2016 07:57
InfoAdditions for iOS using the BluetoothLE ANE
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
<string>bluetooth-peripheral</string>
@marchbold
marchbold / distriqt.extension.bluetoothle.manifestAdditions.xml
Created July 16, 2016 07:53
Manifest Additions for the Bluetooth ANE
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
</manifest>
@marchbold
marchbold / distriqt.extension.googleanaltics.measurePromotions.as
Created July 13, 2016 02:09
Measuring Promotions using the Google Analytics ANE
var promotion:Promotion = new Promotion()
.setId("PROMO_1234")
.setName("Summer Sale")
.setCreative("summer_banner2")
.setPosition("banner_slot1");
var builder:ScreenViewBuilder = ScreenViewBuilder(
new ScreenViewBuilder()
.addPromotion( promotion )
);
@marchbold
marchbold / distriqt.extension.googleanalytics.checkoutProcess.as
Created July 13, 2016 01:41
Measuring the Checkout Process using the Google Analytics ANE
var product:Product = new Product()
.setId( "P12345" )
.setName("Android Warhol T-Shirt")
.setCategory("Apparel/T-Shirts")
.setBrand("Google")
.setVariant("black")
.setPrice(29.20)
.setCouponCode("APPARELSALE")
.setQuantity(1);
@marchbold
marchbold / distriqt.extension.googleanalytics.sendTransaction.as
Last active July 13, 2016 01:19
Sending a transaction using Enhanced Ecommerce and the GoogleAnalytics ANE
var product:Product = new Product()
.setId( "P12345" )
.setName("Android Warhol T-Shirt")
.setCategory("Apparel/T-Shirts")
.setBrand("Google")
.setVariant("black")
.setPrice(29.20)
.setCouponCode("APPARELSALE")
.setQuantity(1);
@marchbold
marchbold / distriqt.extension.location.stopMonitoringRegion.as
Created July 12, 2016 01:50
Stop monitoring a Geofence Region using the Location ANE
var success:Boolean = Location.service.geofences.stopMonitoringRegion( region );
Location.service.geofences.removeEventListener( RegionEvent.START_MONITORING, startMonitoringHandler );
Location.service.geofences.removeEventListener( RegionEvent.STOP_MONITORING, stopMonitoringHandler );
Location.service.geofences.removeEventListener( RegionEvent.ENTER, enterHandler );
Location.service.geofences.removeEventListener( RegionEvent.EXIT, exitHandler );
// com.distriqt.Location
@marchbold
marchbold / distriqt.extension.location.startMonitoringRegion.as
Last active July 12, 2016 01:49
Start monitoring a Geofence Region using the Location ANE
Location.service.geofences.addEventListener( RegionEvent.START_MONITORING, startMonitoringHandler );
Location.service.geofences.addEventListener( RegionEvent.STOP_MONITORING, stopMonitoringHandler );
Location.service.geofences.addEventListener( RegionEvent.ENTER, enterHandler );
Location.service.geofences.addEventListener( RegionEvent.EXIT, exitHandler );
var region:Region = new Region();
region.identifier = "some-unique-id";
region.latitude = 14.123456;
region.longitude = 12.345678;
region.radius = 100;