I have the code below (app live, and I got a crash reported at the line with mService.consumePurchase):
Thread trd = new Thread(new Runnable()
{
@Override
public void run()
{
try
{
int response = mService.consumePurchase(3, getPackageName(), sku.mToken);
if (response == 0)
{
System.out.println("onActivityResult consume ok");
purchasesOK.add(sku.mSku);
}
else
{
System.out.println("onActivityResult consume failed");
purchasesFail.add(sku.mSku);
runOnUiThread(new Runnable()
{
public void run()
{
alert("Store Problems!", "There were problems consuming the product, please use RESTORE button.");
}
});
}
} catch (RemoteException e) {
purchasesFail.add(sku.mSku);
System.out.println("onActivityResult consume crashed");
runOnUiThread(new Runnable()
{
public void run()
{
alert("Store Problems!", "There were problems consuming the product, please use RESTORE button.");
}
});
}
}
});
trd.start();
here is the crash report:
java.lang.NullPointerException at com.XXXXX.GGActivity.j_ItemPurchase(GGActivity.java:1309) at com.XXXXX.GGLib.step(Native Method) at com.XXXXX.GGView$Renderer.onDrawFrame(GGView.java:436) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523) at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
I thought that try/catch will show the popup error in any case of exception. Any ideas what might caused it ? Or how can I avoid it?
Thanks, /C.