Ich versuche, aufdringlich von pushy.me zu arbeiten mit Xamarin. Ich habe eine Bindungsbibliothek für Pushy erstellt und es baut gut. Auf Pushy.Register (Kontext) bekomme ich eine Ausnahme geworfen. Ich kann nicht herausfinden, was die Ausnahme verursacht, hat jemand anderes versucht, dies in Xamarin zu implementieren und war erfolgreich oder habe irgendwelche Ideen, was schief gehen könnte.PushyNetworkException geworfen auf Pushy.Register
Die eception geworfen wird auf
JNIEnv.GetString (JNIEnv.CallStaticObjectMethod (class_ref, id_register_Landroid_content_Context_, __args), JniHandleOwnership.TransferLocalRef);
Dank
ME.Pushy.Sdk.Util.Exceptions.PushyNetworkException: android.os.NetworkOnMainThreadException
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [0x0000c] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00082] in /Users/builder/data/lanes/3511/ce955cc0/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:12649
at Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x00000] in /Users/builder/data/lanes/3511/ce955cc0/source/monodroid/src/Mono.Android/JNIEnv.g.cs:562
at ME.Pushy.Sdk.Pushy.Register (Android.Content.Context p0) [0x00047] in E:\GitHub\ugs-mobile-app\PushyBindingsLibrary\obj\Debug\generated\src\ME.Pushy.Sdk.Pushy.cs:98
--- End of managed ME.Pushy.Sdk.Util.Exceptions.PushyNetworkException stack trace ---
me.pushy.sdk.util.exceptions.PushyNetworkException: android.os.NetworkOnMainThreadException
at me.pushy.sdk.util.PushyHTTP.post(PushyHTTP.java:61)
at me.pushy.sdk.Pushy.register(Pushy.java:126)
at md52b714a6cf9c1cb241b63b6417cd05e8f.SplashActivity.n_onCreate(Native Method)
at md52b714a6cf9c1cb241b63b6417cd05e8f.SplashActivity.onCreate(SplashActivity.java:30)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
static IntPtr id_register_Landroid_content_Context_;
// Metadata.xml XPath method reference: path="/api/package[@name='me.pushy.sdk']/class[@name='Pushy']/method[@name='register' and count(parameter)=1 and parameter[1][@type='android.content.Context']]"
[Register ("register", "(Landroid/content/Context;)Ljava/lang/String;", "")]
public static unsafe string Register (global::Android.Content.Context p0)
{
if (id_register_Landroid_content_Context_ == IntPtr.Zero)
id_register_Landroid_content_Context_ = JNIEnv.GetStaticMethodID (class_ref, "register", "(Landroid/content/Context;)Ljava/lang/String;");
try
{
JValue* __args = stackalloc JValue[1];
__args[0] = new JValue(p0);
string __ret =JNIEnv.GetString(JNIEnv.CallStaticObjectMethod(class_ref,id_register_Landroid_content_Context_, __args),JniHandleOwnership.TransferLocalRef);
return __ret;
}
catch (SystemException e)
{
return null;
}
catch (ME.Pushy.Sdk.Util.Exceptions.PushyNetworkException e)
{
return null;
}
finally
{
}
}
Aufdringliche hier Gründer. Es ist erwähnenswert, dass wir vor kurzem offizielle Dokumentation und Unterstützung für Xamarin.Android Apps veröffentlicht haben: https://pushy.me/docs/additional-platforms/xamarin-android –