关于极光推送unity插件的问题


(zpp1) #1

我在用极光推送unity插件,打包app之后再极光后台发送消息收不到,只有在断网重连之后才能收到消息,求助各位大佬到底是怎么回事


#2

App 处于什么状态,是不是长连接断开了。


(zpp1) #3

app处于打开的状态,就是只有断网重连才能收到通知,第一次是收不到的


(zpp1) #4

是插件的问题么,插件可以直接用么,需要修改什么么,大佬


#5

该问题出现在 Android 还是 iOS?
插件的版本多少?

将你上述测试得到的所有的客户端日志提供一下


(zpp1) #6

是安卓的 ,现在用的是3.2.0,不过所有的版本我都用了,都一样,没看到日志在哪啊


#7

(zpp1) #8

插件是不是因为没有初始化,就是这个JPushInterface.init(this);


(zpp1) #9

我用as重新打个aar包放到unity里然后就报错。

CommandInvokationFailure: Unable to convert classes into dex format.
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/apple/Desktop/android-sdk-macosx/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbitter/jnibridge/JNIBridge;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbitter/jnibridge/JNIBridge$a;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/player/NativeLoader;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/player/ReflectionHelper;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/player/ReflectionHelper$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/player/ReflectionHelper$a;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/player/UnityPlayer;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/player/UnityPlayer$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/player/UnityPlayer$10;

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
	at com.android.dx.command.dexer.Main.run(Main.java:277)
	at com.android.dx.command.dexer.Main.main(Main.java:245)
	at com.android.dx.command.Main.main(Main.java:106)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at SDKMain.main(SDKMain.java:129)
Caused by: java.lang.InterruptedException: Too many errors
	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
	... 9 more
]
stdout[
ignored resource /unity_ceshi/New Unity Project 1/Temp/StagingArea/android-libraries/jpush-unity-plugin-release/libs/./armeabi-v7a/libjcore119.so
processing archive /unity_ceshi/New Unity Project 1/Temp/StagingArea/android-libraries/jpush-unity-plugin-release/libs/./classes.jar...
processing cn/jiguang/unity/push/BuildConfig.class...
processing cn/jiguang/unity/push/JPushBridge.class...
processing cn/jiguang/unity/push/JPushBridge$1.class...
processing cn/jiguang/unity/push/JPushEventReceiver.class...
processing cn/jiguang/unity/push/JPushReceiver.class...
processing cn/jiguang/unity/push/UnityPluginActivity.class...
processing archive /unity_ceshi/New Unity Project 1/Temp/StagingArea/android-libraries/jpush-unity-plugin-release/libs/./jcore-android-1.1.9.jar...

#10

1、首先,你现在有没有在安装后调初始化的 API ?初始化只需要调一次

2、其次,初始化是需要时间的,我刚刚想到你可能是在初始化还没有成功的时候就推送了消息

3、判断初始化是否成功的标准是,看他能不能取到regIstrationID值。


(zpp1) #11

插件本身是可以直接用的么,还是原本就有这个问题


#12

插件肯定可以用的呀,但是需要你配上自己的一些 AppKey 相关的信息,调 API 初始化呀


(zpp1) #13

那怎么初始化呢,插件都是封装好的


#14

看 APi 文档


(zpp1) #15
public static void Init(string gameObject)
        {
            #if UNITY_ANDROID
            _plugin.Call("initPush", gameObject);

            #elif UNITY_IOS
            _init(gameObject);

            #endif
        」

这种么


(HuminiOS) #16

可以参考 demo的初始化方法:

    void Start()
    {
        gameObject.name = "Main Camera";
        JPushBinding.Init(gameObject.name);
        JPushBinding.SetDebug(true);
    }