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 / CompassExample.as
Last active December 17, 2015 22:29
This is a simple example of using the compass ANE from distriqt to get compass heading updates.
/**
* __ __ __
* ____/ /_ ____/ /______ _ ___ / /_
* / __ / / ___/ __/ ___/ / __ `/ __/
* / /_/ / (__ ) / / / / / /_/ / /
* \__,_/_/____/_/ /_/ /_/\__, /_/
* / /
* \/
* http://distriqt.com
* -------------------------------------
@marchbold
marchbold / gist:6616707
Created September 18, 2013 22:36
iOS notification payload
{
aps =
{
alert = "test example notification message";
sound = "example.caf";
};
}
@marchbold
marchbold / distriqt.extension.adverts.example
Last active August 29, 2015 13:57
Adverts ANE example for initialisation, and basic usage.
try
{
Adverts.init( DEV_KEY );
if (Adverts.isSupported)
{
Adverts.service.addEventListener( AdvertEvent.RECEIVED_AD, adverts_receivedAdHandler, false, 0, true );
Adverts.service.addEventListener( AdvertEvent.ERROR, adverts_errorHandler, false, 0, true );
Adverts.service.addEventListener( AdvertEvent.USER_EVENT_DISMISSED, adverts_userDismissedHandler, false, 0, true );
Adverts.service.addEventListener( AdvertEvent.USER_EVENT_LEAVE, adverts_userLeaveHandler, false, 0, true );
@marchbold
marchbold / distriqt.extension.camera.example.timeline.as
Last active February 19, 2016 04:58
A simple example adapted to use Camera extension. This demonstrates initialising the extension, setting up listeners, adding the video frames and updating, and capturing an image on click.
/**
* __ __ __
* ____/ /_ ____/ /______ _ ___ / /_
* / __ / / ___/ __/ ___/ / __ `/ __/
* / /_/ / (__ ) / / / / / /_/ / /
* \__,_/_/____/_/ /_/ /_/\__, /_/
* / /
* \/
* http://distriqt.com
* -------------------------------------
@marchbold
marchbold / distriqt.extension.notifications.example.as
Last active August 29, 2015 13:57
Simple example of displaying a local notification.
try
{
Notifications.init( APP_KEY );
if (Notifications.isSupported)
{
Notifications.service.addEventListener( NotificationEvent.NOTIFICATION_SELECTED, notifications_notificationSelectedHandler, false, 0, true );
//
// This will trigger the start up notification if the application was started from a delayed notification
// Also this will perform the required registration for notifications permission on iOS 8+
@marchbold
marchbold / distriqt.camera.helper.applyOrientation
Last active August 29, 2015 13:57
Rotate a bitmap data to account for image orientation
function applyOrientation( bitmapData:BitmapData, orientation:String ) :BitmapData
{
/*
1) transform="";;
2) transform="-flip horizontal";;
3) transform="-rotate 180";;
4) transform="-flip vertical";;
5) transform="-transpose";;
6) transform="-rotate 90";;
7) transform="-transverse";;
@marchbold
marchbold / distriqt.extension.networkinfo.example.as
Last active January 15, 2016 21:35
Determine the network availability of your application, whether it has an internet access and whether it is a cellular (WWAN) or WiFi connection
NetworkInfo.init( "" );
NetworkInfo.networkInfo.addEventListener(
NetworkInfoEvent.CHANGE,
networkChangeHandler
);
...
@marchbold
marchbold / distriqt.extension.adverts.example.as
Last active April 23, 2018 06:31
This very simple example demonstrates initialising the extension and the advertising platform and then displaying an advert aligned to the bottom centre.
if (Adverts.isSupported)
{
Adverts.service.initialisePlatform( AdvertPlatform.PLATFORM_ADMOB );
var adView:AdView = Adverts.service.createAdView();
adView.setAdSize( AdSize.SMART_BANNER );
adView.setAdUnitId( AD_UNIT_ID );
adView.setViewParams( new AdViewParamsBuilder()
.setVerticalAlign( AdViewParams.ALIGN_BOTTOM )
.setHorizontalAlign( AdViewParams.ALIGN_CENTER )
@marchbold
marchbold / distriqt.extension.adverts.eventhandling.as
Last active April 23, 2018 06:35
distriqt.extension.adverts.eventhandling.as
if (Adverts.isSupported)
{
Adverts.service.initialisePlatform( AdvertPlatform.PLATFORM_ADMOB );
var adView:AdView = Adverts.service.createAdView();
adView.setAdUnitId( AD_UNIT_ID );
adView.setAdSize( AdSize.SMART_BANNER );
// Add advert event listeners
adView.addEventListener( AdViewEvent.LOADED, loadedHandler );
@marchbold
marchbold / distriqt.extension.gameservices.initialisation.as
Created February 5, 2015 01:45
This example demonstrates initialising the extension and then initialising the game platform.
if (GameServices.isSupported)
{
GameServices.init( Config.distriqtApplicationKey );
trace( "GameServices Supported: " + GameServices.isSupported );
trace( "GameServices Version: " + GameServices.service.version );
GameServices.service.addEventListener( GameServicesEvent.INITIALISED, initialisedHandler );
if (GameServices.service.isServiceSupported( Service.GOOGLE_PLAY_GAME_SERVICES ))