0
Android 용 mono를 사용하여 앱을 개발 중이며 푸시 알림 기능을 사용하기 위해 애 쓰고 있습니다. Urban Flyship을 사용하고 있습니다.Mono에서 JNI를 사용하여 Java 라이브러리에 액세스
은 지금까지 나는 이륙()와 EnablePush()를 호출 할 수있게되었습니다 내 응용 프로그램은 성공적으로 다음 코드를 참조 등록된다 (지금 PushManager.shared로 전화를 걸 필요가
//_____________________________
// Get the airship config class
IntPtr ip_airshipConfigOptions = JNIEnv.FindClass("com/urbanairship/AirshipConfigOptions");
if (ip_airshipConfigOptions == IntPtr.Zero)
{
throw new InvalidOperationException("Counldn't find java class !");
}
//__________________________________________________
// Get the loadDefaults method from the config class
IntPtr methodId = JNIEnv.GetStaticMethodID(ip_airshipConfigOptions, "loadDefaultOptions", "(Landroid/content/Context;)Lcom/urbanairship/AirshipConfigOptions;");
if (methodId == IntPtr.Zero)
{
throw new InvalidOperationException("Couldn't find java class !");
}
//________________________________________________________________
// Call the loadDefaultOptions method passing in this app instance
var methodPtr = JNIEnv.CallStaticObjectMethod(ip_airshipConfigOptions, methodId, new JValue(this));
//________________________
// Get the UAirship class
IntPtr ip_uairship = JNIEnv.FindClass("com/urbanairship/UAirship");
if (ip_uairship == IntPtr.Zero)
{
throw new InvalidOperationException("Couldn't find java class !");
}
//___________________________________________
// Get takeOff method with configoption param
IntPtr methodId2 = JNIEnv.GetStaticMethodID(ip_uairship, "takeOff", "(Landroid/app/Application;Lcom/urbanairship/AirshipConfigOptions;)V");
//______________________________________________
// Get takeOff method without configoption param
//IntPtr methodId3 = JNIEnv.GetStaticMethodID(ip_uairship, "takeOff", "(Landroid/app/Application;)V");
//___________________________________________________________________________________________
// Call UAirship.takeOff(this, options). Not sure if these parameters are specified correctly
JNIEnv.CallStaticVoidMethod(ip_uairship, methodId2, new JValue(this), new JValue(methodPtr));
//________________________________________
// Enable Push in Urban Airship Pushmanager
IntPtr ip_pushmanager = JNIEnv.FindClass("com/urbanairship/push/PushManager");
IntPtr ip_enablePush = JNIEnv.GetStaticMethodID(ip_pushmanager, "enablePush", "()V");
JNIEnv.CallStaticVoidMethod(ip_pushmanager, ip_enablePush);
을) .setIntentReciever (myClass)하지만 shared() 클래스 또는 setIntentReciever 메서드에 액세스 할 수 없습니다. 메소드에 액세스하려고 시도하지만 클래스/메소드가 계속 예외를 발견하지 못하도록 여러 가지 조합을 시도했습니다.
감사의 말을 전합니다. 한 줄로 해결할 수있을 것이라고 확신합니다. 문법에 뭔가 빠져있는 것 같습니다.
감사
는, 자바에서 통화는 다음과 같습니다. PushManager.shared()를 setIntentReceiver (IntentReceiver를 .수업); – Adrian