02-22-2012 05:00 AM - edited 02-22-2012 07:12 AM
Application (used cocos2d-x) freezed in paymentservice_purchase_request, looks like modal dialog exists, but not visible.
But sample from NDK-Samples works fine.
Solved! Go to Solution.
02-23-2012 11:15 AM
Tryed add PaymentService to CubeRotate - same effect. No purchase dialog visible at top of window with opengl graphics. At least in simulator.
02-23-2012 12:08 PM
Can you please elaborate a bit more, so I can try (and investigate) it here? A snippet of code would be helpful.
02-23-2012 12:19 PM
In CubeRotation sample
In file main.cpp before line
while (!exit_application) {
i've inserted:
paymentservice_request_events(0); paymentservice_set_connection_mode(true); const char* digital_good_id = "Digital-Good-1-ID"; const char* digital_good_name = "Sample Digital Good 1"; const char* digital_good_sku = "SAMPLE_DIGITAL_GOOD_SKU_1"; const char* metadata = "Sample purchase metadata"; const char* purchase_app_icon = "http://www.rim.com/products/appworld_3col.jpg"; const char* purchase_app_name = "Payment Service Sample App"; unsigned request_id = 0; if (paymentservice_purchase_request(digital_good_id, digital_good_sku, digital_good_name, metadata, purchase_app_name, purchase_app_icon, get_window_group_id(), &request_id) != BPS_SUCCESS) { fprintf(stderr, "Error: purchase request failed.\n"); }
02-23-2012 12:29 PM - edited 02-23-2012 12:34 PM
The event loop (where you inserted your code) is the responsible for dispatching all the events that happen to your application so they can be routed property.
If you make anything modal there, you will basically choke your application from receiving gestures (for example, clicking a button).
while (!exit_application)
{
//Request and process BPS next available event
bps_event_t *event = NULL;
rc = bps_get_event(&event, 0);
assert(rc == BPS_SUCCESS);
if (event)
{
int domain = bps_event_get_domain(event);
if (domain == screen_get_domain())
{
/*
* [fsimoes] If you comment out this line, your
* application won't be able to handle touch gestures.
*/
handleScreenEvent(event);
}
else if ((domain == navigator_get_domain())
&& (NAVIGATOR_EXIT == bps_event_get_code(event)))
{
exit_application = 1;
}
}
render();
}
The best solution would be moving the code you inserted in the event loop to a worker thread, created when you press a button (or click the cube), for example.
02-23-2012 01:29 PM
I'm inserted purchase request BEFORE event handling loop, and event handling code doesn't reached, because i must do something in purchase debug window, but can't, since doesn't see it.
02-23-2012 03:00 PM - edited 02-23-2012 11:25 PM
I'm found problem with Rotating Cube and purchases. In window creation code no call of screen_create_window_group ![]()