Cordova pugin definitions for use in Dart projects.

Generally speaking, any interactions with plugins should happen after the "deviceReady" event has fired. See example for a simple implementation.

Supported plugins

  • Device
  • Platform (property)
  • UUID (property)
  • Splashscreen
  • show();
  • hide();
  • AdMob (Pro Version)
  • createBanner(BannerOptions options);
  • hideBanner();
  • showBanner(int position);
  • showBannerAtXY(int x, int y);
  • removeBanner();
  • prepareInterstitial(InterstitialOptions options);
  • showInterstitial();
  • In-app Purchase
  • ProductEvent when(String v);
  • refresh();
  • order(String v);
  • ready(Function v);
  • register(StoreProduct product);
  • Google Analytics
  • startTrackerWithId(String v);
  • trackView(String v);
  • trackEvent(String category, String action, String label, num v);
  • trackException(String description, bool fatal);
  • trackTiming(String category, num intervalInMilliseconds, String v, String label);
  • addTransaction(String id, String affiliation, num revenue, num tax, num shipping, String currencyCode);
  • addTransactionItem(String id, String name, String sku, String category, num price, num quantity, String currencyCode);
  • addCustomDimension(String key, String value, Function success, Function error);
  • setUserId(String id);
  • debugMode();
  • enableUncaughtExceptionReporting(bool enable, Function success, Function error);
  • In-app Browser
  • InappBrowser open(String url, String target, String options);
  • addEventListener(String eventname, Function cb);
  • removeEventListener(String eventname, Function cb);
  • close();
  • show();
  • executeScript(InjectDetails details, Function cb);
  • insertCSS(InjectDetails details, Function cb);
  • Amazon Mobile Ads
  • See additional notes below
  • All ad methods are supported.
  • Events are not supported yet

Amazon Ads Specific Notes

Amazon doesn't make it easy to integrate Cordova with their ad platform but here's some notes.

With this package, there is a "AmazonAds" class that has a developer-friendly interface to the plugin. You should see if that meets your needs before going directly to the methods in "amazon_mobile_ads.dart".

To install the plugin, you'll have to download it from Amazon and install it manually. It's not in npm (so you can't do cordova plugin add <>)


A simple usage example:

import 'dart:html';
import 'package:dartins/dartins.dart';

main() {

	    //Device Example
	    var currentPlatform = Device.platform;
	    print('Currently using a ${currentPlatform} device');

	    //Splashscreen Example

	    //AdMob example
	    AdMob.createBanner(new BannerOptions(
			adId: 'cx-xxx',
			position: AdMobPosition.BOTTOM_CENTER.index,
			isTesting: Device.UUID == '123123',
			overlap: true

		//Store example
		Store.register(new StoreProduct(id: 'product1', type: StoreProduct.NON_CONSUMABLE));
        Store.when('product1').approved(allowInterop((var product){
            print('Successfully bought product1');
        Store.when('product1').owned(allowInterop((var product){
            print('Owns product1');

        //Analytics example
        GoogleAnalytics.trackEvent('AppState', 'started');

        //In-app browser example
        InappBrowser iab = InappBrowser.open('http://google.com', InappBrowser.TARGET_BLANK);