Archive for the ‘Uncategorized’ Category

Xamarin / playing background music and pausing for sound / text to speech (tts) playback

In FinishedLaunching, add:

AVAudioSession.SharedInstance().SetCategory (AVAudioSessionCategory.Ambient);

This will make any background music/sounds continue to play when starting your app. 
When playing a sound / tts in the app, use; 

var avsession = AVAudioSession.SharedInstance();
avsession.SetActive (true);
avsession.SetCategory (AVAudioSessionCategory.Playback, AVAudioSessionCategoryOptions.DuckOthers);

This will lower the volume on the background music, now you can play the desired sound, for instance (in my current case it is tts); 

speaker.SpeakUtterance (speechUtterance);

Depending on what you are playing, it has a DidFinish, for instance; 

speaker.DidFinishSpeechUtterance += (object sender, AVSpeechSynthesizerUteranceEventArgs e) => {
avsession.SetActive (false, AVAudioSessionSetActiveOptions.NotifyOthersOnDeactivation);

Which will tell the background music to ‘unduck’. 

Prevent annoying iTunes & Image capture from starting when you plug in your phone

Not sure why anyone would want this to happen, anyway:


– goto system preferences -> users & groups
– goto your user -> Login items
– remove iTunes Helper (I don’t want anything started myself)

Image capture is easy as well however it’s an easy option to overlook; 
– open Image capture 
– click on your device (this is the step most forums / blogs about this miss)
– in the left bottom corner click the arrow and set it to No Application: 

Kivy / mouse cursor not showing up after startup

(on OS X but applies to other OSs) 

After searching, recompiling all libraries, etc for two hours someone on #kivy pointed me to ~/.kivy/config.ini which has a show_cursor = 0/1. In my case it was 0. I never touched it (just freshly installed Kivy) and the default is 1, however, it was 0 and thus my cursor did not show.

Xamarin Pushwoosh C# library for iOS / PushNotificationManager.PushManager is null

The instructions on the Pushwoosh site  shows crudely how to install this library for Xamarin. There are different reasons why this won’t work, but the most annoying results (on iOS 8+) in pushManager being null without any errors or issues.

One reason for that Pushwoosh_APPID is missing from the Into.plist.

The other issue, when null still appears is something I have not figured out. Simply removing all the references from the project and recompiling works sometimes; clean all doesn’t etc. It seems to be a common issue (happens often), but no-one so far produced exact steps to fix it.