2016-10-14 31 views
2

我正在一个Unity应用程序。当它处于前台并且用户从通知栏中点击通知视图并且正在触发挂起的意图时,它会崩溃。应用程序崩溃,logcat中没有明确的堆栈跟踪可用。在前景中的Unity应用程序崩溃,并点击从相同的应用程序创建的通知

什么程序崩溃的过程中,我可以看到的是如下

I/WindowState: WIN DEATH: Window{26cb4ca u0 com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity} 
10-14 16:28:57.234 1796-2360/? 

下面是logcat的一块,当用户点击通知:

10-14 16:28:56.359 3669-3669/? W/Timer-46: type=1400 audit(0.0:1190715): avc: denied { getattr } for uid=10230 path="/proc/194" dev="proc" ino=8077 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0 
10-14 16:28:56.402 2404-2404/? D/StatusBar: Clicked on content of 0|com.aman.unitytest|10343|null|10231 
10-14 16:28:56.410 1796-7655/? W/NotificationService: No notification with key: 0|com.aman.unitytest|10343|null|10231 
--------- beginning of system 
10-14 16:28:56.419 1796-1806/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.aman.unitytest cmp=com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity} from uid 10231 on display 0 
10-14 16:28:56.435 2404-2404/? V/PhoneStatusBar: setLightsOn(true) 
10-14 16:28:56.448 1796-10063/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: [email protected] attribute=null, token = [email protected] 
10-14 16:28:56.458 356-356/? I/SFPerfTracer:  triggers: (rate: 13:886) (compose: 0:2) (post: 0:1) (render: 1:49) (480:43276 frames) (481:45950) 
10-14 16:28:56.459 356-356/? D/SFPerfTracer:  layers: (3:10) (FocusedStackFrame (0xb82131a0): 0:384)* (DimLayer (0xb8214f88): 0:23)* (StatusBar (0xb825eee8): 57:4149) (NavigationBar (0xb82b3180): 16:1944) (com.android.systemui.ImageWallpaper (0xb82a7ea0): 1:241)* (DimLayer (0xb82d3d08): 0:392)* (DimLayer (0xb8264580): 0:40)* (com.aman.unitytest/com.unity3d.player.UnityPlayerActivity (0xb8287078): 0:8)* (SurfaceView (0xb8288340): 479:4873) 
10-14 16:28:56.719 382-968/? W/APM::EffectDescriptor: unregisterEffect() unknown effect ID 354 
10-14 16:28:56.839 1796-3013/? D/bsthal: setDelay, handle: 1598182229 delay: 200000000 
10-14 16:28:56.839 1796-3013/? E/bsthal: <BST> set delay: 200000000ns 
10-14 16:28:56.839 1796-3013/? I/bsthal: <BST> set delay of <BOSCH BMC150 Acceleration Sensor> to 200ms 
10-14 16:28:56.861 1796-10063/? D/bsthal: activate, handle: 1598182242, enabled: 1, index 2 
10-14 16:28:56.861 1796-10063/? D/bsthal: BstSensorExt: id=1598182242, en=1 
10-14 16:28:56.861 1796-10063/? D/bsthal: enable ID_SORI, path /sys/class/srot_sensor/g_sensor/en_disp_rotation, fd 233 
10-14 16:28:56.861 1796-2337/? D/bsthal: readEvents,event.type is 4,event value is -1,event code is 3 
10-14 16:28:56.862 1796-2337/? D/bsthal: readEvents,event.type is 0,event value is 0,event code is 0 
10-14 16:28:56.864 1796-10063/? D/bsthal: setDelay, handle: 1598182242 delay: 66667000 
10-14 16:28:56.886 2404-2404/? V/PhoneStatusBar: setLightsOn(true) 
10-14 16:28:56.900 2404-2404/? D/PhoneStatusBar: disable: < expand icons* alerts system_info* back home recent clock search quick_settings > 
10-14 16:28:56.909 2404-2404/? V/QSTileView: setDual true 
10-14 16:28:56.909 2404-2404/? V/QSTileView: setDual false 
10-14 16:28:56.931 1796-1940/? I/LaunchCheckinHandler: Displayed com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity,wp,wa,512 
10-14 16:28:57.203 25990-25990/? I/Process: Sending signal. PID: 25990 SIG: 9 
10-14 16:28:57.233 1796-7655/? I/WindowState: WIN DEATH: Window{26cb4ca u0 com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity} 
10-14 16:28:57.234 1796-2360/? D/WifiService: Client connection lost with reason: 4 
10-14 16:28:57.238 1796-2833/? I/WindowState: WIN DEATH: Window{5747b17 u0 com.aman.unitytest/com.unity3d.player.UnityPlayerActivity} 
10-14 16:28:57.281 1796-3017/? I/ActivityManager: Process com.aman.unitytest (pid 25990) has died 
10-14 16:28:57.281 1796-3017/? W/ActivityManager: Scheduling restart of crashed service com.aman.unitytest/semusi.activitysdk.Api in 1000ms 
10-14 16:28:57.282 1796-3017/? W/ActivityManager: Force removing ActivityRecord{38d66f8 u0 com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity t994}: app died, no saved state 
10-14 16:28:57.282 1796-3017/? I/ActivityManager: moveHomeStack, setupComplete:true 
10-14 16:28:57.287 1796-3017/? D/bsthal: activate, handle: 1598182242, enabled: 0, index 2 
10-14 16:28:57.287 1796-3017/? D/bsthal: BstSensorExt: id=1598182242, en=0 
10-14 16:28:57.287 1796-3017/? D/bsthal: enable ID_SORI, path /sys/class/srot_sensor/g_sensor/en_disp_rotation, fd 103 
10-14 16:28:57.313 25901-25938/? V/ConnectivityManager: isActiveNetworkMetered() returns:false 
+1

调试您的代码并检查崩溃背后的原因..我们无法仅通过检查日志来提供帮助。 – Gattsu

+0

H maven,Thnx供您考虑。但你可以帮助我如何调试统一应用程序来检查是什么原因导致上述问题。 –

回答

1

得到了问题,并使其可行。以下是现在用于pendingIntent通知的内容。

launchIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); 

而在使用unity时,它们是AndroidManfiest.xml中提到的不推荐使用的Launcher,如下所示。停止使用它了。

com.unity3d.player.UnityPlayerProxyActivity 

请改用您的AndroidManifest中的以下条目以使其正确。

<activity 
      android:name="com.unity3d.player.UnityPlayerActivity" 
      android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

由于ProxyActivity下面在其的onCreate()。因此,无论您在pendingIntent中添加的任何标志都没有关系。此代理活动将忽略所有内容。

paramBundle = new String[] { "com.unity3d.player.UnityPlayerActivity", "com.unity3d.player.UnityPlayerNativeActivity" }; 
    copyPlayerPrefs(this, paramBundle); 
    try 
    { 
     int i = Build.VERSION.SDK_INT >= 9 ? 1 : 0; 
     paramBundle = Class.forName(paramBundle[0]); 
     (paramBundle = new Intent(this, paramBundle)).addFlags(65536); 
     Bundle localBundle; 
     if ((localBundle = getIntent().getExtras()) != null) { 
     paramBundle.putExtras(localBundle); 
     } 
     startActivity(paramBundle); 
     return; 
    } 
    catch (ClassNotFoundException localClassNotFoundException) {}finally 
    { 
     finish(); 
    }