Package: igeSdk
igeSdkigeSdk is a compilation of all necessary third party SDKs in order to make your game ready to be published, which contains Analytics, Advertisement, InAppPurchase and CrossPromotion features.The current implementation status is as below:Analytics : Ready (v0.0.1)Advertisement : Ready (v0.0.2)InAppPurchase : Ready (v0.0.3)CrossPromotion : Ready (v0.0.4)The SDK supportsAndroidandiOSplatforms. On unsupported platforms (Windows, Linux, MacOS, ...), it the code still running with dummy functionalities.Configuration and InitializationTo config the SDK, you need to createigeSdk.configwhich is a json file contains settings for different modules.Configuration for Advertisement, InAppPurchase and CrossPromotion is WIP.To initialize the SDK, justimport igeSdkand callinit()method in your main logic code, like below:importigeSdkclassGameManager(Script):defonStart(self):igeSdk.init()# Other initialization stuffsThe code above will inialize all the enabled modules which are configured in the configuration file.Notice, the SDK only initialize modules which have been configured. So, to disable unwanted modules, just remove their settings out of the configuration file.AnalyticThe Analytics module is used in order to send informations to the different analytics platforms. We are currently using Facebook, GameAnalytics and AppsFlyer.To configure Analytics features, put those settings intoigeSdk.config:{"android":{"FacebookAppId":"","FacebookClientToken":"","AppsFlyerApiKey":"","AppsFlyerAppId":"","GameAnalyticsGameKey":"","GameAnalyticsSecretKey":"",},"ios":{"FacebookAppId":"","FacebookClientToken":"","AppsFlyerApiKey":"","AppsFlyerAppId":"","GameAnalyticsGameKey":"","GameAnalyticsSecretKey":"",}}Trackers for Advertisement, InAppPurchase and CrossPromotion modules are sent automatically by the SDK. Game developers should only focus on Progression and Design events to boost their games' performance and revenues, using API below:importigeSdkfromigeSdkimportAnalytics# Level started event: send when player start new levelAnalytics.levelStarted(levelName:str)# Level passed event: send when player successfully passed the levelAnalytics.levelPassed(levelName:str,score:int)# Level failed event: send when player failed the levelAnalytics.levelFailed(levelName:str,score:int)# Custom event: used to track other stuffs like game design events, game states, ...Analytics.customEvent(eventName:str,eventValue_optional:float)AdvertisementAdvertisement module handles all ad-related operations for you, by implementing AppLovin MAX solution. This module provides methods for Banner, Interstitial and Rewarded Video ads, accessible withigeSdk.Advertisementmodule.ConfigurationTo configure Advertisement features, put those settings intoigeSdk.config:{"android":{"Mediation":"MAX","MediationAppId":"","AdMobAppId":"","BannerId":"","InterstitialId":"","RewardedVideoId":""},"ios":{"Mediation":"MAX","MediationAppId":"","AdMobAppId":"","BannerId":"","InterstitialId":"","RewardedVideoId":""}}Showing/Hiding BannerTo show/hide banner ads, use methods below:fromigeSdkimportAdvertisementAdvertisement.showBanner(position:int,callback:Callable[[errCode:int,message:str],None])Advertisement.hideBanner(callback:Callable[[errCode:int,message:str],None])In which:position: [Optional] one of values below, default toigeSdk.AdPosition_BottomCenter.igeSdk.AdPosition_TopLeftigeSdk.AdPosition_TopCenterigeSdk.AdPosition_TopRightigeSdk.AdPosition_CenterLeftigeSdk.AdPosition_CenteredigeSdk.AdPosition_CenterRightigeSdk.AdPosition_BottomLeftigeSdk.AdPosition_BottomCenterigeSdk.AdPosition_BottomRightcallback: [Optional] callback function.Showing InterstitialTo show interstitial ads, use method below:fromigeSdkimportAdvertisementAdvertisement.showInterstitial(placement:str,callback:Callable[[errCode:int,message:str],None])In which:placement: [Optional] placement id as string, default is'default'.callback: [Optional] callback function.You can also check if interstitial ads is available (to display a button for example), usingAdvertisement.isInterstitialAvailable().Showing Rewarded VideoTo show rewarded video ads, use method below:fromigeSdkimportAdvertisementAdvertisement.showRewardedVideo(placement:str,callback:Callable[[errCode:int,message:str,reward_type:str,reward_amount:float],None])In which:placement: [Optional] placement id as string, default is'default'.callback: [Optional] callback function.You can also check if rewarded video ads is available (to display a button for example), usingAdvertisement.isRewardedVideoAvailable().InAppPurchaseInAppPurchase module allows you to simply integrate cross-platform In App Purchase (IAP) into your game. The module support iOS and Android billing systems.ConfigurationTo configure InAppPurchase module, put those settings intoigeSdk.config:{"android":{"IAPProductIds":["net.indigames.bundle.noads"],"IAPPublicKey":"YOUR APP PUBLIC KEY FROM GOOGLE PLAY CONSOLE"},"ios":{"IAPProductIds":["net.indigames.bundle.noads"]}}IAPProductIds is a list of product IDs that have been registed with Google Play Store and Apple AppStore.To register products, please follow documents below:Google Play ConsoleApple AppStore ConnectNoAds IAPTo register NoAds IAP, you need to register a product ID which containnoadstext, which is a non-consummable item. The logic of checking and disabling ads is automatically done by the SDK without needs of extra works from developers.List ProductsTo get the list of products available on store, use function below:fromigeSdkimportInAppPurchaseInAppPurchase.listProducts(callback:Callable[[status:int,products:List[IAPProduct]],None])In which:callback: The callback funtion once the product list fetched, or failed in case of error.Example:fromigeSdkimportInAppPurchaseclassGameManager(Script):....deflistProductsCallback(self,status,products):ifstatus==0andlen(products)>0:forproductinproducts:print(f"{product.id}-{product.title}-{product.price}-{product.locale}")else:print("[WARN] listProductsCallback: there is no product on store, please ensure you have product ids added in igeSdk, and your app is already previewed by Apple / Google")defonStart(self):InAppPurchase.listProducts(self.listProductsCallback)Notice, you should only showNoAdsbutton after fetched the product list, because if the products are not ready and if the purchase called it will do nothing which may confuse users.PurchaseTo purchase a product, use function below:fromigeSdkimportInAppPurchaseInAppPurchase.purchase(productId:str,callback:Callable[[status:int,products:List[IAPProduct]],None])In which:productId: the product Idcallback: The callback funtion once the product is purchased, or failed in case of error.Example:fromigeSdkimportInAppPurchaseclassBtnNoAds(Script):....defpurchaseCallback(self,status,products):ifstatus==0andlen(products)>0:forproductinproducts:print(f"Purchased:{product.id}-{product.title}-{product.price}-{product.locale}")else:print("[WARN] listProductsCallback: there is no product on store, please ensure you have product ids added in igeSdk, and your app is already previewed by Apple / Google")defonClick(self):InAppPurchase.purchase('',self.purchaseCallback)TheNoAdsresult is handled internally. If the transaction is a success, the banner will be hidden and all interstitial requests will be blockedDepending on the user's connection, the transaction can take a certain amount of time, we suggest you to block any playable input once a transaction is initiated and to display a loading screen showing the user that the purchase is processing.If an error occurs during the transaction, the purchaseResult callback will send you an error reason that you should display on screen.-1:Failed, general issue like connection, IAP setting, ...0:Succeed1:NotInitialized, the purchase/restore function has been called when the IAP module is initializing2:IdentifierNotFound, the productID not found on store3:InvalidReceipt, receipt validation failed, which mean this maybe tampering issue with the receipt.4:NoRestorablePurchase, when call restore but not made a purchase before5:AlreadyPurchased, non-consummable product has already been purchased, so just need to restore or get it for free.RestoreIn case the player have purchased a Non-Consumable product (such as the IAP) and deletes the game, you need to restore their purchases.With Google Play, the restoration is done automatic on launch. But for Apple, the restoration needs to be triggered (the user may need to re-authentify), we can't do it automatically on launch as it could be frustrating for the player to have an authentification popup at each launch.You need to implement a Restore Purchases button somewhere in your UI to allow the restoration, this button must trigger the following function:fromigeSdkimportInAppPurchaseInAppPurchase.restore(callback:Callable[[status:int,products:List[IAPProduct]],None])In which:callback: The callback funtion once the product(s) is restored, or failed in case of error.TheNoAdsproduct restoration is handled internally.CrossPromotionGDPRThe General Data Protection Regulation (GDPR) is an European data protection law that entered into force in May 2018. In order to comply with the regulation, the game need to show GDPR dialog asking for user confirmation before collecting any data from the device.The igeSDK handled the GDPR automatically on the app's first lauch. However, it is required to add a button in game setting to access GDPR/CCPA again in order to change the setting, by calling:fromigeSdkimportCrossPromoifCrossPromo.isInGdprCountry():CrossPromo.showGdpr()Interstitial Cross PromotionTo show interstitial we have this method:fromigeSdkimportCrossPromoCrossPromo.showInterstitial()Square Cross PromotionTo show square, use method below:fromigeSdkimportCrossPromoCrossPromo.showSquare(x:float,y:float,w:int,h:int)In which:x, y: the top-left position of the square to be shown. If it is in range of 0.0 - 1.0, then it will be the percentage to the screen width and height accordingly.w, h: the size of the square to display.To hide square, use method below:fromigeSdkimportCrossPromoCrossPromo.hideSquare()