bool is_bluetooth_message_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); return (bool)env->CallBooleanMethod(g_Obj, g_is_bluetooth_message); }
int OuyaController_getPlayerNum_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); return (int)env->CallIntMethod(g_Obj, g_OuyaController_getPlayerNum); }
s3eResult InitAds_platform(const char* pub_id) { JNIEnv* env = s3eEdkJNIGetEnv(); jstring pub_id_jstr = env->NewStringUTF(pub_id); return (s3eResult)env->CallIntMethod(g_Obj, g_InitAds, pub_id_jstr); }
bool OuyaController_selectControllerByDeviceID_platform(int deviceID) { JNIEnv* env = s3eEdkJNIGetEnv(); return (bool)env->CallBooleanMethod(g_Obj, g_OuyaController_selectControllerByDeviceID, deviceID); }
bool OuyaController_getButton_platform(int button) { JNIEnv* env = s3eEdkJNIGetEnv(); return (bool)env->CallBooleanMethod(g_Obj, g_OuyaController_getButton, button); }
void MATSetLocation_platform(double latitude, double longitude, double altitude) { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_MATSetLocation, latitude, longitude, altitude); }
void OuyaController_startOfFrame_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_OuyaController_startOfFrame); }
void PollFishShow_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_PollFishShow); }
s3eResult CGPollfishInit_platform() { // Get the environment from the pointer JNIEnv* env = s3eEdkJNIGetEnv(); jobject obj = NULL; jmethodID cons = NULL; const JNINativeMethod nativeMethodDefs[] = { { "native_notifyReceived", "()V", (void *)&native_notifyReceived }, { "native_notifyNotAvailable", "()V", (void *)&native_notifyNotAvailable }, { "native_notifyCompleted", "()V", (void *)&native_notifyCompleted }, { "native_notifyOpened", "()V", (void *)&native_notifyOpened }, { "native_notifyClosed", "()V", (void *)&native_notifyClosed }, { "native_notifyNotEligible", "()V", (void *)&native_notifyNotEligible }, }; // Get the extension class jclass cls = s3eEdkAndroidFindClass("CGPollfish"); if (!cls) goto fail; // Get its constructor cons = env->GetMethodID(cls, "<init>", "()V"); if (!cons) goto fail; // Construct the java class obj = env->NewObject(cls, cons); if (!obj) goto fail; // Get all the extension methods g_PollFishInit = env->GetMethodID(cls, "PollFishInit", "(Ljava/lang/String;IILjava/lang/String;)V"); if (!g_PollFishInit) goto fail; g_PollFishHide = env->GetMethodID(cls, "PollFishHide", "()V"); if (!g_PollFishHide) goto fail; g_PollFishShow = env->GetMethodID(cls, "PollFishShow", "()V"); if (!g_PollFishShow) goto fail; if(env->RegisterNatives(cls, nativeMethodDefs, sizeof(nativeMethodDefs)/sizeof(nativeMethodDefs[0]))) goto fail; IwTrace(CGPOLLFISH, ("CGPOLLFISH init success")); g_Obj = env->NewGlobalRef(obj); env->DeleteLocalRef(obj); env->DeleteGlobalRef(cls); // Add any platform-specific initialisation code here return S3E_RESULT_SUCCESS; fail: jthrowable exc = env->ExceptionOccurred(); if (exc) { env->ExceptionDescribe(); env->ExceptionClear(); IwTrace(CGPollfish, ("One or more java methods could not be found")); } env->DeleteLocalRef(obj); env->DeleteGlobalRef(cls); return S3E_RESULT_ERROR; }
void bluetooth_show_wrong_version_dialog_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_bluetooth_show_wrong_version_dialog); }
s3eResult bluetoothInit_platform() { // Get the environment from the pointer JNIEnv* env = s3eEdkJNIGetEnv(); jobject obj = NULL; jmethodID cons = NULL; // Get the extension class jclass cls = s3eEdkAndroidFindClass("bluetooth"); if (!cls) goto fail; // Get its constructor cons = env->GetMethodID(cls, "<init>", "()V"); if (!cons) goto fail; // Construct the java class obj = env->NewObject(cls, cons); if (!obj) goto fail; // Get all the extension methods g_init_bluetooth = env->GetMethodID(cls, "init_bluetooth", "()Z"); if (!g_init_bluetooth) goto fail; g_enable_bluetooth = env->GetMethodID(cls, "enable_bluetooth", "()V"); if (!g_enable_bluetooth) goto fail; g_disable_bluetooth = env->GetMethodID(cls, "disable_bluetooth", "()V"); if (!g_disable_bluetooth) goto fail; g_is_bluetooth_enabled = env->GetMethodID(cls, "is_bluetooth_enabled", "()Z"); if (!g_is_bluetooth_enabled) goto fail; g_bluetooth_close = env->GetMethodID(cls, "bluetooth_close", "()V"); if (!g_bluetooth_close) goto fail; g_bluetooth_enable_discoverability = env->GetMethodID(cls, "bluetooth_enable_discoverability", "()V"); if (!g_bluetooth_enable_discoverability) goto fail; g_bluetooth_is_discovering = env->GetMethodID(cls, "bluetooth_is_discovering", "()Z"); if (!g_bluetooth_is_discovering) goto fail; g_bluetooth_setup_client = env->GetMethodID(cls, "bluetooth_setup_client", "()V"); if (!g_bluetooth_setup_client) goto fail; g_is_bluetooth_connected = env->GetMethodID(cls, "is_bluetooth_connected", "()Z"); if (!g_is_bluetooth_connected) goto fail; g_bluetooth_message_start = env->GetMethodID(cls, "bluetooth_message_start", "()V"); if (!g_bluetooth_message_start) goto fail; g_bluetooth_message_write_float = env->GetMethodID(cls, "bluetooth_message_write_float", "(Ljava/lang/String;)V"); if (!g_bluetooth_message_write_float) goto fail; g_bluetooth_message_write_int = env->GetMethodID(cls, "bluetooth_message_write_int", "(I)V"); if (!g_bluetooth_message_write_int) goto fail; g_bluetooth_message_send_current = env->GetMethodID(cls, "bluetooth_message_send_current", "()V"); if (!g_bluetooth_message_send_current) goto fail; g_is_bluetooth_message = env->GetMethodID(cls, "is_bluetooth_message", "()Z"); if (!g_is_bluetooth_message) goto fail; g_bluetooth_message_read_int = env->GetMethodID(cls, "bluetooth_message_read_int", "()I"); if (!g_bluetooth_message_read_int) goto fail; g_bluetooth_message_read_float = env->GetMethodID(cls, "bluetooth_message_read_float", "()F"); if (!g_bluetooth_message_read_float) goto fail; g_bluetooth_message_discard_current = env->GetMethodID(cls, "bluetooth_message_discard_current", "()V"); if (!g_bluetooth_message_discard_current) goto fail; g_bluetooth_show_wrong_version_dialog = env->GetMethodID(cls, "bluetooth_show_wrong_version_dialog", "()V"); if (!g_bluetooth_show_wrong_version_dialog) goto fail; IwTrace(BLUETOOTH, ("BLUETOOTH init success")); g_Obj = env->NewGlobalRef(obj); env->DeleteLocalRef(obj); env->DeleteGlobalRef(cls); // Add any platform-specific initialisation code here return S3E_RESULT_SUCCESS; fail: jthrowable exc = env->ExceptionOccurred(); if (exc) { env->ExceptionDescribe(); env->ExceptionClear(); IwTrace(bluetooth, ("One or more java methods could not be found")); } return S3E_RESULT_ERROR; }
void bluetooth_message_discard_current_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_bluetooth_message_discard_current); }
float bluetooth_message_read_float_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); return (float)env->CallFloatMethod(g_Obj, g_bluetooth_message_read_float); }
int bluetooth_message_read_int_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); return (int)env->CallIntMethod(g_Obj, g_bluetooth_message_read_int); }
void MATSetAge_platform(int age) { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_MATSetAge, age); }
void MATSDKParameters_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_MATSDKParameters); }
void MATSetGender_platform(int gender) { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_MATSetGender, gender); }
void MATTrackInstall_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_MATTrackInstall); }
s3eResult MATSDKInit_platform() { // Get the environment from the pointer JNIEnv* env = s3eEdkJNIGetEnv(); jobject obj = NULL; jmethodID cons = NULL; // Get the extension class jclass cls = s3eEdkAndroidFindClass("s3eMATSDK"); if (!cls) goto fail; // Get its constructor cons = env->GetMethodID(cls, "<init>", "()V"); if (!cons) goto fail; // Construct the java class obj = env->NewObject(cls, cons); if (!obj) goto fail; // Get all the extension methods g_MATStartMobileAppTracker = env->GetMethodID(cls, "MATStartMobileAppTracker", "(Ljava/lang/String;Ljava/lang/String;)V"); if (!g_MATStartMobileAppTracker) goto fail; g_MATSDKParameters = env->GetMethodID(cls, "MATSDKParameters", "()V"); if (!g_MATSDKParameters) goto fail; g_MATTrackInstall = env->GetMethodID(cls, "MATTrackInstall", "()V"); if (!g_MATTrackInstall) goto fail; g_MATTrackUpdate = env->GetMethodID(cls, "MATTrackUpdate", "()V"); if (!g_MATTrackUpdate) goto fail; g_MATTrackInstallWithReferenceId = env->GetMethodID(cls, "MATTrackInstallWithReferenceId", "(Ljava/lang/String;)V"); if (!g_MATTrackInstallWithReferenceId) goto fail; g_MATTrackActionForEventIdOrName = env->GetMethodID(cls, "MATTrackActionForEventIdOrName", "(Ljava/lang/String;ZLjava/lang/String;)V"); if (!g_MATTrackActionForEventIdOrName) goto fail; g_MATTrackActionForEventIdOrNameItems = env->GetMethodID(cls, "MATTrackActionForEventIdOrNameItems", "(Ljava/lang/String;ZLjava/util/List;Ljava/lang/String;DLjava/lang/String;ILjava/lang/String;)V"); if (!g_MATTrackActionForEventIdOrNameItems) goto fail; g_MATTrackAction = env->GetMethodID(cls, "MATTrackAction", "(Ljava/lang/String;ZDLjava/lang/String;)V"); if (!g_MATTrackAction) goto fail; g_MATSetPackageName = env->GetMethodID(cls, "MATSetPackageName", "(Ljava/lang/String;)V"); if (!g_MATSetPackageName) goto fail; g_MATStartAppToAppTracking = env->GetMethodID(cls, "MATStartAppToAppTracking", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V"); if (!g_MATStartAppToAppTracking) goto fail; /////// g_MATSetCurrencyCode = env->GetMethodID(cls, "MATSetCurrencyCode", "(Ljava/lang/String;)V"); if (!g_MATSetCurrencyCode) goto fail; g_MATSetUserId = env->GetMethodID(cls, "MATSetUserId", "(Ljava/lang/String;)V"); if (!g_MATSetUserId) goto fail; g_MATSetRevenue = env->GetMethodID(cls, "MATSetRevenue", "(D)V"); if (!g_MATSetRevenue) goto fail; g_MATSetSiteId = env->GetMethodID(cls, "MATSetSiteId", "(Ljava/lang/String;)V"); if (!g_MATSetSiteId) goto fail; g_MATSetTRUSTeId = env->GetMethodID(cls, "MATSetTRUSTeId", "(Ljava/lang/String;)V"); if (!g_MATSetTRUSTeId) goto fail; g_MATSetDebugMode = env->GetMethodID(cls, "MATSetDebugMode", "(Z)V"); if (!g_MATSetDebugMode) goto fail; g_MATSetAllowDuplicates = env->GetMethodID(cls, "MATSetAllowDuplicates", "(Z)V"); if (!g_MATSetAllowDuplicates) goto fail; g_MATSetAge = env->GetMethodID(cls, "MATSetAge", "(I)V"); if (!g_MATSetAge) goto fail; g_MATSetGender = env->GetMethodID(cls, "MATSetGender", "(I)V"); if (!g_MATSetGender) goto fail; g_MATSetLocation = env->GetMethodID(cls, "MATSetLocation", "(DDD)V"); if (!g_MATSetLocation) goto fail; ////// IwTrace(MATSDK, ("MATSDK init success")); g_Obj = env->NewGlobalRef(obj); env->DeleteLocalRef(obj); env->DeleteGlobalRef(cls); // Add any platform-specific initialisation code here return S3E_RESULT_SUCCESS; fail: jthrowable exc = env->ExceptionOccurred(); if (exc) { env->ExceptionDescribe(); env->ExceptionClear(); IwTrace(s3eMATSDK, ("One or more java methods could not be found")); } return S3E_RESULT_ERROR; }
void MATTrackUpdate_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_MATTrackUpdate); }
bool OuyaController_selectControllerByPlayer_platform(int playerNum) { JNIEnv* env = s3eEdkJNIGetEnv(); return (bool)env->CallBooleanMethod(g_Obj, g_OuyaController_selectControllerByPlayer, playerNum); }
void MATTrackActionForEventIdOrNameItems_platform(const char* eventIdOrName, bool isId, const MATArray* items, const char* refId, double revenueAmount, const char* currencyCode, uint8 transactionState, const char* receipt) { IwTrace(s3eMATSDK, ("In event items method")); JNIEnv* jni_env = s3eEdkJNIGetEnv(); // local variables for the track action jstring eventIdOrName_jstr = jni_env->NewStringUTF(eventIdOrName); jstring refId_jstr = jni_env->NewStringUTF(refId); jstring currencyCode_jstr = jni_env->NewStringUTF(currencyCode); jstring receipt_jstr = jni_env->NewStringUTF(receipt); // create an ArrayList class const char* list_class_name = "java/util/ArrayList"; jclass clsList = jni_env->FindClass(list_class_name); jmethodID constructorIDList = jni_env->GetMethodID(clsList, "<init>", "()V"); jobject jlistobj = jni_env->NewObject(clsList, constructorIDList); jmethodID list_add_mid = 0; list_add_mid = jni_env->GetMethodID(clsList, "add", "(Ljava/lang/Object;)Z"); // MATEventItem definition const char* mateventitem_class_name = "com/mobileapptracker/MATEventItem"; jclass clsMATEventItem = jni_env->FindClass(mateventitem_class_name); jmethodID constructorID = jni_env->GetMethodID(clsMATEventItem, "<init>", "(Ljava/lang/String;IDDLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); // Add a MATEventItem for each item to a List for (uint i = 0; i < items->m_count; i++) { /* IwTrace(s3eMATSDK, ("Item %s, unitPrice %f, quantity %i, revenue %f, attribute1 %s, attribute2 %s, attribute3 %s, attribute4 %s, attribute5 %s", ((MATSDKEventItem*)items->m_items)[i].name, ((MATSDKEventItem*)items->m_items)[i].unitPrice, ((MATSDKEventItem*)items->m_items)[i].quantity, ((MATSDKEventItem*)items->m_items)[i].revenue, ((MATSDKEventItem*)items->m_items)[i].attribute1, ((MATSDKEventItem*)items->m_items)[i].attribute2, ((MATSDKEventItem*)items->m_items)[i].attribute3, ((MATSDKEventItem*)items->m_items)[i].attribute4, ((MATSDKEventItem*)items->m_items)[i].attribute5));*/ jstring nameVal = jni_env->NewStringUTF(((MATSDKEventItem*)items->m_items)[i].name); jstring att1Val = jni_env->NewStringUTF(((MATSDKEventItem*)items->m_items)[i].attribute1); jstring att2Val = jni_env->NewStringUTF(((MATSDKEventItem*)items->m_items)[i].attribute2); jstring att3Val = jni_env->NewStringUTF(((MATSDKEventItem*)items->m_items)[i].attribute3); jstring att4Val = jni_env->NewStringUTF(((MATSDKEventItem*)items->m_items)[i].attribute4); jstring att5Val = jni_env->NewStringUTF(((MATSDKEventItem*)items->m_items)[i].attribute5); // Create a MATEventItem jobject jeventitemobj = jni_env->NewObject(clsMATEventItem, constructorID, nameVal, ((MATSDKEventItem*)items->m_items)[i].quantity, ((MATSDKEventItem*)items->m_items)[i].unitPrice, ((MATSDKEventItem*)items->m_items)[i].revenue, att1Val, att2Val, att3Val, att4Val, att5Val); // Add the MATEventItem to the List jboolean jbool = jni_env->CallBooleanMethod(jlistobj, list_add_mid, jeventitemobj); jni_env->DeleteLocalRef(nameVal); jni_env->DeleteLocalRef(att1Val); jni_env->DeleteLocalRef(att2Val); jni_env->DeleteLocalRef(att3Val); jni_env->DeleteLocalRef(att4Val); jni_env->DeleteLocalRef(att5Val); } jni_env->CallVoidMethod(g_Obj, g_MATTrackActionForEventIdOrNameItems, eventIdOrName_jstr, isId, jlistobj, refId_jstr, revenueAmount, currencyCode_jstr, transactionState, receipt_jstr); jni_env->DeleteLocalRef(eventIdOrName_jstr); jni_env->DeleteLocalRef(refId_jstr); jni_env->DeleteLocalRef(currencyCode_jstr); jni_env->DeleteLocalRef(receipt_jstr); }
int OuyaController_getAxisValue_platform(int axis) { JNIEnv* env = s3eEdkJNIGetEnv(); return (int)env->CallIntMethod(g_Obj, g_OuyaController_getAxisValue, axis); }
void MATSetRevenue_platform(double revenue) { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_MATSetRevenue, revenue); }
bool OuyaController_buttonChangedThisFrame_platform(int button) { JNIEnv* env = s3eEdkJNIGetEnv(); return (bool)env->CallBooleanMethod(g_Obj, g_OuyaController_buttonChangedThisFrame, button); }
void MATSetDebugMode_platform(bool shouldDebug) { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_MATSetDebugMode, shouldDebug); }
s3eResult ODKInit_platform() { // Get the environment from the pointer JNIEnv* env = s3eEdkJNIGetEnv(); jobject obj = NULL; jfieldID field = NULL; // Get the extension class jclass cls = s3eEdkAndroidFindClass("com/ODK/ODK"); if (!cls) goto fail; IwTrace(ODK, ("ODK init Found: com/ODK/ODK")); field = env->GetStaticFieldID(cls, "m_Activity", "Lcom/ODK/ODK;"); if (!field) goto fail; IwTrace(ODK, ("ODK init Found: GetStaticFieldID")); obj = env->GetStaticObjectField(cls,field); if (!obj) goto fail; IwTrace(ODK, ("ODK init Found: GetStaticObjectField ")); /* // Get its constructor cons = env->GetMethodID(cls, "<init>", "()V"); if (!cons) goto fail; // Construct the java class obj = env->NewObject(cls, cons); if (!obj) goto fail; */ // Get all the extension methods g_OuyaController_startOfFrame = env->GetMethodID(cls, "OuyaController_startOfFrame", "()V"); if (!g_OuyaController_startOfFrame) goto fail; g_OuyaController_selectControllerByPlayer = env->GetMethodID(cls, "OuyaController_selectControllerByPlayer", "(I)Z"); if (!g_OuyaController_selectControllerByPlayer) goto fail; g_OuyaController_selectControllerByDeviceID = env->GetMethodID(cls, "OuyaController_selectControllerByDeviceID", "(I)Z"); if (!g_OuyaController_selectControllerByDeviceID) goto fail; g_OuyaController_getAxisValue = env->GetMethodID(cls, "OuyaController_getAxisValue", "(I)I"); if (!g_OuyaController_getAxisValue) goto fail; g_OuyaController_getButton = env->GetMethodID(cls, "OuyaController_getButton", "(I)Z"); if (!g_OuyaController_getButton) goto fail; g_OuyaController_buttonPressedThisFrame = env->GetMethodID(cls, "OuyaController_buttonPressedThisFrame", "(I)Z"); if (!g_OuyaController_buttonPressedThisFrame) goto fail; g_OuyaController_buttonReleasedThisFrame = env->GetMethodID(cls, "OuyaController_buttonReleasedThisFrame", "(I)Z"); if (!g_OuyaController_buttonReleasedThisFrame) goto fail; g_OuyaController_buttonChangedThisFrame = env->GetMethodID(cls, "OuyaController_buttonChangedThisFrame", "(I)Z"); if (!g_OuyaController_buttonChangedThisFrame) goto fail; g_OuyaController_getPlayerNum = env->GetMethodID(cls, "OuyaController_getPlayerNum", "()I"); if (!g_OuyaController_getPlayerNum) goto fail; IwTrace(ODK, ("ODK init success")); g_Obj = env->NewGlobalRef(obj); env->DeleteLocalRef(obj); env->DeleteGlobalRef(cls); // cache class references g_pluginOuya.CacheClasses(env); // Add any platform-specific initialisation code here return S3E_RESULT_SUCCESS; fail: jthrowable exc = env->ExceptionOccurred(); if (exc) { env->ExceptionDescribe(); env->ExceptionClear(); IwTrace(ODK, ("One or more java methods could not be found")); } return S3E_RESULT_ERROR; }
void MATSetAllowDuplicates_platform(bool allowDuplicates) { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_MATSetAllowDuplicates, allowDuplicates); }
s3eResult ShowAds_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); return (s3eResult)env->CallIntMethod(g_Obj, g_ShowAds); }
void bluetooth_message_write_int_platform(int value) { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_bluetooth_message_write_int, value); }