开发者

ACTION_USER_PRESENT with Unity3d causes crash after splashScreen

I have made a java plugin for a unity game that turns music back on when the screen is unlocked. On Android 2.3.3 it works without problem but I am getting complains that it crashes the game under Android 2.2 . I don't have a device to test this, but there are a LOT of complains so something is really wrong.

Did someone experienced the same problem?

The Java plugin contains only a BroadcastReceiver which sends a message to unity:

    public void onReceive(Context arg0, Intent intent) {
    if(intent.getAction().equals(Intent.ACTION_USER_PRESENT))
    {
        try {
                UnityPlayer.UnitySendMessage("Camera", "OnUserReturned", null);
            } catch (UnsatisfiedLinkError e) {
                Log.e("UNITY_SEND_MSG", e.getMessage());
                e.printStackTrace();
            }
    }
        }

In the Manifest:

<receiver android:name="UserPresentReceiver">
        <intent-filter>
           <action android:name="android.intent.action.USER_PRESENT" /> 
        </intent-filter>
    </receiver>

I can't figure out that is causing there crashes and I can't reproduce them under Android 2.3 . Can someone help me whit this or suggest another approach for stopping the music under lock screen and restarting it after the lock screens gone?

Thanks in advance

EDIT: StackTrace:

01-01 02:29:31.036: WARN/dalvikvm(8970): JNI WARNING: received null jstring (Check_GetStringUTFChars)
01-01 02:29:31.036: INFO/dalvikvm(8970): "main" prio=5 tid=1 NATIVE
01-01 02:29:31.036: INFO/dalvikvm(8970):   | group="main" sCount=0 dsCount=0 s=N obj=0x4001d928 self=0xccd8
01-01 02:29:31.036: INFO/dalvikvm(8970):   | sysTid=8970 nice=0 sched=0/0 cgrp=default handle=-1345017812
01-01 02:29:31.036: INFO/dalvikvm(8970):   | schedstat=( 3072569000 2291321000 12753 )
01-01 02:29:31.036: INFO/dalvikvm(8970):   at com.unity3d.player.UnityPlayer.UnitySendMessage(Native Method)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at com.angrymobgames.userpresent.UserPresentReceiver.onReceive(UserPresentReceiver.java:19)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at android.app.ActivityThread.handleReceiver(ActivityThread.java:2810)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at android.app.ActivityThread.access$3200(ActivityThread.java:125)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at android.os.Looper.loop(Looper.java:123)
01-01 02:29:31.036: INFO/dalvikvm(8970): 开发者_如何学Go  at android.app.ActivityThread.main(ActivityThread.java:4627)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at java.lang.reflect.Method.invokeNative(Native Method)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at java.lang.reflect.Method.invoke(Method.java:521)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-01 02:29:31.036: INFO/dalvikvm(8970):   at dalvik.system.NativeStart.main(Native Method)
01-01 02:29:31.036: ERROR/dalvikvm(8970): VM aborting
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜