|
8 年之前 | |
---|---|---|
.. | ||
proj.android | 8 年之前 | |
Readme.md | 8 年之前 |
This will be added into the samples later :)
For the to compile correctly you must do the following.
IAP class must be called with
loadPlugin("IAPGooglePlay")
Item must be in google format like so
pInfo["IAPId"] = "com.game.example.item1"
// pInfo is of type TProductInfo
The developer info must be specific to your app like so
pPlayStoreInfo["GooglePlayAppKey"] = "Big long key from google :)"
s_pPlayStore->configDeveloperInfo(pPlayStoreInfo);
// s_pPlayStore is of type cocos2d::plugin::ProtocolIAP*
##From Java
// This must be added to the new Cocos2dxActivity.java classes in cocos2d-x 3.0 + recently added
private static Set<OnActivityResultListener> onActivityResultListeners = new LinkedHashSet<OnActivityResultListener>();
public static void addOnActivityResultListener(OnActivityResultListener listener) {
onActivityResultListeners.add(listener);
}
public static Set<OnActivityResultListener> getOnActivityResultListeners() {
return onActivityResultListeners;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
for (OnActivityResultListener listener : Cocos2dxHelper.getOnActivityResultListeners()) {
listener.onActivityResult(requestCode, resultCode, data);
}
super.onActivityResult(requestCode, resultCode, data);
}