nullpointerexception - Strange null pointer exception after in-app purchase successful (Android) -
i've written app in app billing (iab). seems work fine, except 1 thing. if instigate purchase, google play iab purchase appears , purchase item fine, purchase complete window appears, , disappears fine. however, main app doesn't seem start animating again , after few seconds, app crashes. logcat
output says null pointer exception (related own coding - nothing android specific)
try { bundle buyintentbundle = mservice.getbuyintent(3, mactivity.getpackagename(), (string)args[1], "inapp", "bgoa+v7g/yqdxvkrqq+jtfn4uqzbpiqjo4pf9rzj"); if(buyintentbundle.getint("response_code") == billing_response_result_ok) { pendingintent pendingintent = buyintentbundle.getparcelable("buy_intent"); try { mactivity.startintentsenderforresult(pendingintent.getintentsender(), 1001, new intent(), integer.valueof(0), integer.valueof(0), integer.valueof(0)); } catch (sendintentexception e) { log.v("myinfo", "error purchasing item."); e.printstacktrace(); } } else { log.v("myinfo", "error purchasing item."); showresponse(buyintentbundle.getint("response_code")); } } catch (remoteexception e1) { e1.printstacktrace(); }
this code within own asynctask purchasing class, , mactivity main activity. code
mactivity.startintentsenderforresult(...)
calls 'onactivityresult(...)' fine in main activity, crash occurs.
any ideas might doing wrong?
thank you.
my logcat output it:
v/mediaplayer[native](12951): start e/mediaplayer[native](12951): start called in state 0 v/mediaplayer[native](12951): message received msg=100, ext1=-38, ext2=0 e/mediaplayer[native](12951): error (-38, 0) d/mediaplayer[native](12951): calling notify_player_state: 0 v/mediaplayer[native](12951): callback application v/mediaplayer[native](12951): callback d/mediaplayer[java](12951): broadcasting media_change_player_state(with context) : 0x0 e/mediaplayer[native](12951): invoke failed: wrong state 0 d/mediaplayer[java](12951): broadcasting media_change_player_state(with context) : state = 0 v/mediaplayer[native](12951): mediaplayer::setvolume(0.750000, 0.750000) e/mediaplayer[java](12951): error (-38,0) v/mediaplayerservice( 301): [669] setvolume(0.750000, 0.750000) v/audiosink( 301): setvolume(0.750000, 0.750000) w/dalvikvm(12951): threadid=33: thread exiting uncaught exception (group=0x41b5ee48) e/androidruntime(12951): fatal exception: glthread 22274 e/androidruntime(12951): process: com.mystuff.grame, pid: 12951 e/androidruntime(12951): java.lang.nullpointerexception e/androidruntime(12951): @ com.mystuff.grame.core.spritebatch.add(spritebatch.java:50) e/androidruntime(12951): @ com.mystuff.grame.core.level.draw(level.java:360) e/androidruntime(12951): @ com.mystuff.grame.core.grame.drawgame(grame.java:245) e/androidruntime(12951): @ com.mystuff.grame.core.grame.ondrawframe(grame.java:178) e/androidruntime(12951): @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1523) e/androidruntime(12951): @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1240) w/activitymanager( 972): force finishing activity com.mystuff.grame/.mainactivity d/activitymanager( 972): setfocusedstack: mfocusedstack=activitystack{439390b8 stackid=1, 21 tasks} v/activitymanager( 972): moving pausing: activityrecord{43d96740 u0 com.mystuff.grame/.mainactivity t421 f} v/mediaplayer[native](12951): stop e/mediaplayer[native](12951): stop called in state 0 v/mediaplayer[native](12951): message received msg=100, ext1=-38, ext2=0 e/mediaplayer[native](12951): error (-38, 0) d/mediaplayer[native](12951): calling notify_player_state: 0 v/mediaplayer[native](12951): callback application v/mediaplayer[native](12951): callback v/activitymanager( 972): moving paused: activityrecord{43d96740 u0 com.mystuff.grame/.mainactivity t421 f} (pause complete) v/activitymanager( 972): moving stopping: activityrecord{43d96740 u0 com.mystuff.grame/.mainactivity t421 f} (finish requested) i/activitymanager( 972): resumetopactivitieslocked(): target stack:activitystack{439390b8 stackid=1, 21 tasks} d/activitymanager( 972): resumetopactivitylocked: launching home next v/activitymanager( 972): movehomestack:
it must have in-app purchasing doesn't happen until in app purchase completes... seems in app purchase flow causing of variables become null.
you right. when iap dialog opened, think onpause triggered. if onpause triggered means lot of variables set null , shut down mediaplayer.
alternativly, mediaplayer(which think cause) set forced pause when iap dialog shows up. try pause mediaplayer when purchase flow initialized(or when button pressed triggers it) , reininitialize when done
Comments
Post a Comment