Distriqt GameServices ANE - Apple Game Center Problem - actionscript-3

I'me developing a game in AS3 AIR and I'me using Distriqt GameServices native extension.
The problem is that I can not sign in to Apple Game Center.
In the documentation, it's stated that: If Google Play Services aren’t available then you won’t be able to use the functionality in this extension.
And there's a code snippet:
var result:int = GoogleApiAvailability.instance.isGooglePlayServicesAvailable();
if (result != ConnectionResult.SUCCESS) {
if (GoogleApiAvailability.instance.isUserRecoverableError( result )) {
GoogleApiAvailability.instance.showErrorDialog( result );
} else {
trace( "Google Play Services aren't available on this device" );
}
} else {
trace( "Google Play Services are Available" );
//init here
}
That sounds odd to me because Google Play Services are not available on iOS, naturally.
I've tried to skip this step and initialize the service without checking GoogleApiAvailability. But I'm getting this message after a successful initialization and then calling signIn() method:
The requested operation could not be completed because local player has not been authenticated.
That sounds odd too, because this is the authentication method itself!!
I'm almost sure that my setup is correct. And the extension is working fine on Android.
GameServices ANE Version: 5.0.011
Any help is appreciated,
Thanks

Ah, actually that had nothing to do with the Distriqt GameServices, so sorry.
The message "The requested operation could not be completed because local player has not been authenticated." was coming from iOS meaning the Game Center is not activated on the device.
Switching on Game Center in the device (settings-> gamecenter) solved the issue.

Related

Wait for App to idle after Interruption

I have a ViewController that will request access to location services on init via
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined)
{
[_locationManager requestWhenInUseAuthorization];
}
This triggers the "Allow app to access your location while you use the app?"-alert.
I use [self addUIInterruptionMonitorWithDescription:handler:] to react to this. I am encountering the following problem: after dismissing the request-dialog, the ui-test does not continue. The alert is dismissed, but Xcode waits for the app to become idle, but it looks like the app is idle:
t = 67.35s Wait for app to idle
The test fails, because the app is stuck here. If i tap into the simulator, Xcode logs.
t = 72.27s Synthesize event
and continues the test.
Is there a reason, why Xcode tries to wait for the app? A workaround seems to be to tell Xcode that the UI changed or an event happened. Is there a way to trigger this?
After presenting the alert you must interact with the interface. This is a known bug with Xcode 7.2. Simply tapping the app works just fine, but is required.
addUIInterruptionMonitorWithDescription("Location Dialog") { (alert) -> Bool in
alert.buttons["Allow"].tap()
return true
}
app.buttons["Find Games Nearby?"].tap()
app.tap() // need to interact with the app for the handler to fire
XCTAssert(app.staticTexts["Authorized"].exists)
See my blog post for more information.

iOS 8 - Starling context loss on open camera roll gallery

I am creating an app on iOS in Flash Builder, with as3.
The app uses the Starling plugin: http://wiki.starling-framework.org/start
My app allows users to take photos and customise them. When attempting to access the camera or camera roll on iOS 8, I get the error message "The application lost the device context!".
On Android, I can get around this problem with this line:
Starling.handleLostContext = true;
But I am told that iOS should never lose context (and I haven't seen it lose context on iOS 7 or below).
If I include that line in iOS 8, the application crashes at around the same point, but in this case the app crashes completely, and returns me to the home screen rather than displaying the previous message.
I have heard there are restrictions on iOS 8 with regards to the use of 64 bit/32 bit plugins and extensions, but I am not using any ANEs in this particular app. Are there any other areas where 32-bit could be causing problems or is that strictly related to ANEs?
I don't get this error on iOS 7 or below or Android, unless I set handleLostContext to false.
Adobe Scout provides no error message.
Any help would be appreciated.
UPDATE:
This code calls in the camera functionality:
var cameraRoll:CameraRoll = new CameraRoll();
if(CameraRoll.supportsBrowseForImage) {
trace("camera rolling");
cameraRoll.addEventListener(MediaEvent.SELECT, imageSelected);
cameraRoll.addEventListener(flash.events.Event.CANCEL, browseCanceled);
cameraRoll.addEventListener(flash.events.ErrorEvent.ERROR, galleryMediaError);
cameraRoll.browseForImage();
} else {
var alert:Alert = Alert.show("Image browsing is not supported on this device.", "Error", new ListCollection([{label:"OK"}]));
}
UPDATE 2:
I've switched from AIR SDK 17 to 16, and it is now more stable but has similar issues
There is a known issue with the camera roll in iOS which will cause stage3d to lose context. Your options:
Set Starling.handleLostContext = true, it is possible to lose context in iOS.
Find an ANE (Supposedly these exist) that handles the camera roll without losing context.
More Information:
http://forum.starling-framework.org/topic/starling-and-cameraui#post-77339
I can confirm on ios 8.3 a Context3D is not lost when opening the CameraRoll using AIR 18.
Make sure you are using AIR 18.
Make sure you are using the latest Starling Version.
If the problem persist it's likely Starling is the cause.
Either report the problem and wait for an update.
Do not use Starling when requesting the CameraRoll (turn Starling off and Display normal Bitmaps).
Don't use Starling and use another engine or create your own.

Quintus to Android

I have tried to Google and read the Quintus wiki but no solution. Why does quintus platformer need server to run? Because this I can't use phonegap nor cocoonjs to convert my project to android game. Is there a better HTML5 2d game engine that I can use without server? Or what can I do to get quintus run as android application?
So I finally managed to get the game running with little bit of help, so I am answering here for myself. To get the game running on Android phone you need to quote some code.
Try commenting out this code from your quintus.js file and try again. I was facing a similar issue, commenting out this code resolved it:
if(document.location.origin === "file://" || document.location.origin === "null") {
if(!Q.fileURLAlert) {
Q.fileURLAlert = true;
alert("Quintus Error: Loading assets is not supported from file:// urls - please run from a local web-server and try again");
}
return errorCallback();
Then compile it with CocoonJS Webview+ and install debug.apk to get the game running.

Unauthorized Access Exception when Creating an instance of SpeechSynthesizer in WP8.1 Emulator

I was trying to recreate the simle Text to Speech example used on the MSDN website. However whenever the code came to create the instance of the SpeechSynthesizer class it failed with a Unauthorised Acception error when running on the WP8.1 emulator. I currently do not have an actual device to test on to see if this makes a difference.
My code was simply:
private async void TTS()
{
// The media object for controlling and playing audio.
MediaElement mediaElement = new MediaElement();
// The object for controlling the speech synthesis engine (voice).
var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
// Generate the audio stream from plain text.
SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Hello World");
// Send the stream to the media object.
mediaElement.SetSource(stream, stream.ContentType);
mediaElement.Play();
}
I know there was an issue with the SpeechSynthesizer in Windows 8.1, and I found solutions to this when looking to fix the problem, but found little about the problem with WP8.1 SpeechSynthesizer. Has anybody else came across this problem and found a fix?
You should add one DeviceCapability in Package.appxmanifest file:
In DeviceCapability Tab, check the microphone, because it will provides access to the microphone’s audio feed, which allows the app to record audio from connected microphones.
Look at this library: App capability declarations (Windows Runtime apps)

Flash AS3 and webcam: problems with AIR

I'm having some problems getting the Flash AS3 Camera to work correctly. If you could help, much appreciated. I looked at olThe details:
I'm able, when publishing to a SWF, to get the webcam up and running and all works fine, popping up the 'may I access your camera dialog' which returns muted or not.
• First question: is there any way to make it so I can bypass the user permission, that is always grant it? We are running a kiosk app. Will the following method work for an AIR app? https://stackoverflow.com/questions/3266939/flash-grant-access-to-webcam-programmatically-behind-the-scenes
• Second question: as I said, I can get the webcam/Camera hookup to work fine when publishing for SWF in IDE, and in browser. But if I switch the project to publish for AIR and run the air app, or test in the IDE, I don't get the security permissions dialog coming up at all. Nothing. Perhaps the security box is off screen? Is there some way to control the placement? Is there something different about using the webcam from within AIR?
I'm happy to NOT publish to AIR, but to use SWF — simply need to be able to read/write to XML files on local disk and think that AIR only way to do that?
Thanks for any help!
The code:
private function initTracking() : void
{
var camW : int = 840;
var camH : int = 640;
// Create the camera
_cam = Camera.getCamera();
if (_cam == null)
{
trace("Unable to locate available cameras.");
return;
}
else
{
trace("Found camera: " + _cam.name);
_cam.addEventListener(StatusEvent.STATUS, camStatusHandler);
_cam.setMode(camW, camH, stage.frameRate);
// Create a video
_vid = new Video(camW, camH);
_vid.attachCamera(_cam);
trace("camera ", _cam, " attached to video ", _vid);
// Create the Motion Tracker
_motionTracker = new MotionTracker(_vid);
// We flip the input as we want a mirror image
_motionTracker.flipInput = true;
}
}
private function camStatusHandler(event:StatusEvent):void
{
trace("camStatusHandler::");
if (_cam.muted)
{
trace("Unable to connect to active camera.");
}
else
{
trace("able to connect to active camera.");
addEventListener(Event.ENTER_FRAME, onEnterFrameHandler, false,0,true);
}
// Remove the status event listener.
_cam.removeEventListener(StatusEvent.STATUS, camStatusHandler);
}
If you publish as AIR, there is no security dialog (the security box for swfs is there to stop 'hackers' gaining control of a users webcam without their knowledge).
If your code works in a swf, it should also work in an AIR app without needing any changes - assuming AIR is running on the desktop and not a mobile device?
If you are not seeing the webcam output when you publish as an AIR app, post the relevant code.
Edit:
The StatusEvent.STATUS event does not occur with AIR apps - it fires when user closes security dialog - hence camStatusHandler never gets called.
So remove camStatusHandler function completely and also this line:
_cam.addEventListener(StatusEvent.STATUS, camStatusHandler);
And add important code from camStatusHandler to the end of initTracking:
addEventListener(Event.ENTER_FRAME, onEnterFrameHandler, false,0,true);