Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Workshop: Integrating Amazon APIs in Unity

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Wird geladen in …3
×

Hier ansehen

1 von 42 Anzeige

Workshop: Integrating Amazon APIs in Unity

Herunterladen, um offline zu lesen

Amazon offers several APIs to simplify and streamline development of apps and games, including in-app purchasing, achievements and leaderboards, mobile ads, multi-screen support, and more. This session will describe the simple steps necessary to incorporate Amazon APIs into your app or game developed with Unity.

Amazon offers several APIs to simplify and streamline development of apps and games, including in-app purchasing, achievements and leaderboards, mobile ads, multi-screen support, and more. This session will describe the simple steps necessary to incorporate Amazon APIs into your app or game developed with Unity.

Anzeige
Anzeige

Weitere Verwandte Inhalte

Andere mochten auch (20)

Ähnlich wie Workshop: Integrating Amazon APIs in Unity (20)

Anzeige

Weitere von Amazon Appstore Developers (11)

Aktuellste (20)

Anzeige

Workshop: Integrating Amazon APIs in Unity

  1. 1. @peterdotgames peterheinrich INTEGRATING AMAZ ON APIs IN UNITY PETER HEINRICH D E V E L O P E R E V A N G E L I S T, A M A Z O N
  2. 2. AGENDA A M A Z O N A P I s A C C O U N T S E T U P M O B I L E A D S A M A Z O N F L I N G AD
  3. 3. AGENDA A M A Z O N A P I s A C C O U N T S E T U P M O B I L E A D S A M A Z O N F L I N G AD
  4. 4. AMAZON APIs
  5. 5. C U S TO M E R O B S E S S E D Start with the customer and work backwards. J e f f B e zo s
  6. 6. A P P S TO R E V I S I O N Our vision is to connect content creators and customers through apps, games, and experiences that create value and delight.
  7. 7. ANDROID PHONES & TABLETS FIRE TV & FIRE TV STICK BLACKBERRYFIRE TABLETS
  8. 8. A P I s Login with AmazonIn-App Purchasing Mobile Ads GameCircle Amazon Fling AD Amazon Maps Device Messaging Amazon Drive
  9. 9. A P I s In-App Purchasing Mobile Ads GameCircle Amazon Fling AD Amazon provides support for
  10. 10. AGENDA A M A Z O N A P I s A C C O U N T S E T U P M O B I L E A D S A M A Z O N F L I N G AD
  11. 11. ACCOUNT SET UP
  12. 12. D E V E L O P E R P O RTA L
  13. 13. D E V E L O P E R P O RTA L
  14. 14. D E V E L O P E R P O RTA L
  15. 15. D E V E L O P E R P O RTA L
  16. 16. D E V E L O P E R P O RTA L http://bit.ly/AppstoreSDK
  17. 17. AGENDA A M A Z O N A P I s A C C O U N T S E T U P M O B I L E A D S A M A Z O N F L I N G AD
  18. 18. MOBILE ADS AD
  19. 19. M O B I L E A D S MONETIZATION ACROSS PLATFORMS/ APPSTORES Multiple ad formats optimised for Fire OS, Android, and iOS operating systems Great eCPM – get paid on ad impressions served instead of clicks on ads Highly relevant mobile optimized ads from Amazon and high quality brands D E TA I L S AD
  20. 20. M O B I L E A D S • Static Banners • Rich Media Banners • Static Interstitials • Modeless Interstitials • Rich Media Interstitials (includes click-to-play video)
  21. 21. ADDING THE UNITY PLUGINAD
  22. 22. ADDING THE UNITY PLUGINAD
  23. 23. ADDING THE UNITY PLUGINAD
  24. 24. D E V E L O P E R P O RTA L
  25. 25. D E V E L O P E R P O RTA L
  26. 26. D E V E L O P E R P O RTA L
  27. 27. using com.amazon.mas.cpt.ads; // Obtain object used to interact with the plugin IAmazonMobileAds mobileAds = AmazonMobileAdsImpl.Instance; public string androidKey = "d914c248d27248d19cdd26039bf5846d"; public string iosKey = "9cdd26039bf5846dd914c248d27248d1"; // Construct object passed to sync operation as input ApplicationKey key = new ApplicationKey(); // Use Android app key for Android apps and iOS // app key for iOS apps #if UNITY_ANDROID key.StringValue = androidKey; #elif UNITY_IPHONE key.StringValue = iosKey; #endif // Call method, passing in required input structure // This method does not return a response mobileAds.SetApplicationKey( key ); S E T T H E A P P L I C AT I O N K E Y ( S )
  28. 28. using com.amazon.mas.cpt.ads; public void EnableTesting() { // Obtain object used to interact with the plugin IAmazonMobileAds mobileAds = AmazonMobileAdsImpl.Instance; // Construct object passed to sync operation as input ShouldEnable enable = new ShouldEnable(); // Set input value enable.BooleanValue = true; // Call method, passing in required input structure // This method does not return a response mobileAds.EnableTesting( enable ); mobileAds.EnableLogging( enable ); } E N A B L E T E S T I N G A N D L O G G I N G
  29. 29. <manifest ...> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> ... <application ...> <activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/> ... </application> </manifest> AndroidManifest.xml
  30. 30. using com.amazon.mas.cpt.ads; public void DisplayFloatingAd() { // Obtain object used to interact with the plugin IAmazonMobileAds mobileAds = AmazonMobileAdsImpl.Instance; // Configure the placement of the ad Placement placement = new Placement(); placement.Dock = Dock.TOP; placement.HorizontalAlign = HorizontalAlign.CENTER; placement.AdFit = AdFit.FIT_AD_SIZE; // This method returns an Ad object, which you must save and keep track of Ad response = mobileAds.CreateFloatingBannerAd( placement ); // Now that the ad has been created, load it and show it on the screen LoadingStarted loadResp = mobileAds.LoadAndShowFloatingBannerAd( response ); } C R E AT E A N D D I S P L AY A T E S T A D
  31. 31. using com.amazon.mas.cpt.ads; // Define event handlers private void HandleAdLoaded( Ad args ) { string adType = args.AdType.ToString(); long identifier = args.Identifier; // Do something. . . } private void HandleAdFailedToLoad( Ad args ) { string adType = args.AdType.ToString(); long identifier = args.Identifier; // Do something. . . } // Register for the events mobileAds.AddAdLoadedListener( HandleAdLoaded ); mobileAds.AddAdFailedToLoadListener( HandleAdFailedToLoad ); R E G I S T E R I N G F O R E V E N T S
  32. 32. TO I N I T I AT E A M E T H O D C A L L Obtain the object used to interact with the plugin. S U M M A RY If needed, construct the object used to pass input to the operation. For asynchronous operations, define a callback function that is invoked when a response is ready. Call the operation, passing in any required input and/or callback function as arguments. AD IAmazonMobileAds mobileAds = AmazonMobileAdsImpl.Instance; Placement placement = new Placement(); placement.Dock = Dock.TOP; private void HandleAdLoaded( Ad args ) { // Do something. . . } mobileAds.SetApplicationKey( key ); Example:
  33. 33. AGENDA A M A Z O N A P I s A C C O U N T S E T U P M O B I L E A D S A M A Z O N F L I N G AD
  34. 34. AMAZON FLING
  35. 35. A M A Z O N F L I N G BUILD RICH MULTI-SCREEN EXPERIENCES Cross platform toolkit that enables you to build rich multi-screen experiences for Fire TV Allows sending video, audio and images from iOS, Android, or Fire OS Leverage two-way communication between Amazon Fire TV and mobile apps to create engaging second screen experiences D E TA I L S
  36. 36. using com.amazon.whisperplay.fling.cpt.media.controller; using com.amazon.whisperplay.fling.cpt.media.controller.json; void Start () { deviceList = new SortedList<string, Player>(); if (flingService == null) { flingService = AmazonFlingServiceImpl.Instance; OnResume(); } // Register event handlers flingService.AddPlayerDiscoveredListener( PlayerDiscovered ); flingService.AddPlayerLostListener( PlayerLost ); flingService.AddDiscoveryFailureListener( DiscoveryFailure ); flingService.AddOnStatusChangeListener( OnStatusChange ); // Load resources to display catalog of available media. . . } I N I T I A L I Z E T H E S E RV I C E
  37. 37. private void PlayerDiscovered( Player args ) { deviceList.Add( args.PlayerId, args ); if( previousPlayer != null && args.PlayerId == previousPlayer.PlayerId ) { SetDevice( args ); } if( showDeviceMenu ) { CreatePickerList(); } } private void PlayerLost( Player args ) { deviceList.Remove(args.PlayerId ); if( showDeviceMenu ) { CreatePickerList(); } } E V E N T H A N D L E R S
  38. 38. A D D I T I O N A L D E P L O Y M E N T S T E P S i O S A N D R O I D 1. In Xcode, select your Xcode project root. 2. Select the target Unity-iPhone. 3. Click the Build Phases tab. 4. Open the Link Binary with Libraries foldout. 5. Cluck the + at the bottom of the this foldout. 6. Add all the frameworks and libraries required by the SDK: 1. AmazonFling.framework 2. Bolts.framework 3. AdSupport.framework 4. Security.framework 5. Libc++.dylib 7. Follow iOS SDK’s specific guidelines for importing dependencies. 1. Add these android.permission values to your manifest: On Fire OS & Android: INTERNET ACCESS_WIFI_STATE ACCESS_NETWORK_STATE On Android only: CHANGE_WIFI_MULTICAST_STATE 2. On Fire OS only, add this line to the application section of Plugins/Android/AndroidManifest.xml (and remove the Plugins/Android/WhisperPlay.jar): <uses-library android:name= "com.amazon.whisperplay.contracts" /> http://bit.ly/FlingSteps
  39. 39. WHERE DO WE GO FROM HERE?
  40. 40. W H E R E D O W E G O F R O M H E R E ? N E X T S T E P S CREATE YOUR DEVELOPER ACCOUNT PUBLISH!BUILD YOUR APP REVIEW DEV PORTAL RESOURCES NEW developer.amazon.com/public
  41. 41. Peter Heinrich @peterdotgames @AmazonAppDev heinrich@amazon.co.uk developer.amazon.com/appstore THANK YOU! bit.ly/AmazonSummitFeedback

×