Skip to content

Instantly share code, notes, and snippets.

@dannycabrera
dannycabrera / Send MMS with Image Attachment using Xamarin.iOS
Created May 30, 2014 16:34
Send MMS with Image Attachment using Xamarin.iOS
//Source: http://davidsonblake.wordpress.com/2014/05/29/send-mms-with-image-attachment-using-xamarin-ios/
void SendMMS ()
{ //Init View Controller
var messageController = new MFMessageComposeViewController ();
//Verify app can send text message
if(MFMessageComposeViewController.CanSendText)
{
messageController.Body = "Here's an image for u 2 n joy.";
@dannycabrera
dannycabrera / gist:3367417
Created August 16, 2012 06:41
Speex encode
// Here is what I am attempting, opening the file, encoding it (with your EncodeSpeech method)
// and trying to save the .spx back to a file. The encodedBytes returns with data but the newly
// create file "newFile" does not play. Am I missing something or am I just doing this the wrong
// way? Thanks for all your help.
string audioFile = @"C:\Users\DannyC\Desktop\newFileName.wav";
string newFile = @"C:\Users\DannyC\Desktop\Test.spx";
// Read file bytes
byte[] fileBytes = File.ReadAllBytes (audioFile);
@dannycabrera
dannycabrera / gist:5365508
Created April 11, 2013 17:43
SignalR error with Xamarin.iOS
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Microsoft.AspNet.SignalR.Client.Resources.resources" was correctly embedded or linked into assembly "Microsoft.AspNet.SignalR.Client.iOS" at compile time, or that all the satellite assemblies required are loadable and fully signed.
@dannycabrera
dannycabrera / Xamarin.iOS Table Cell Selected Background Color
Last active December 24, 2015 02:09
Xamarin.iOS Table Cell Selected Background Color
UIView BGViewColor = new UIView ();
BGViewColor.BackgroundColor = UIColor.Red; //or whatever color you want.
BGViewColor.Layer.MasksToBounds = true;
cell.SelectedBackgroundView = BGViewColor;
@dannycabrera
dannycabrera / Xamarin.iOS Create Contact
Created September 27, 2013 15:37
Xamarin.iOS Create Contact
var person = new ABPerson()
{
FirstName = "John",
LastName = "Doe"
};
NSError error;
var ab = ABAddressBook.Create (out error);
ab.Add (person);
@dannycabrera
dannycabrera / Xamarin.iOS IdentifierForVendor
Created September 27, 2013 15:38
Xamarin.iOS IdentifierForVendor
NSUuid identifier = UIDevice.CurrentDevice.IdentifierForVendor;
https://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor
@dannycabrera
dannycabrera / gist:6730630
Created September 27, 2013 15:40
APS-Environment Entitlement
aps-environment - Receive push notifications in iOS
The entitlement key is different for iOS than it is for OS X. On either platform, however,
the provisioning portal assigns a value of development or production to the key, depending
only on which activity you are creating the provisioning profile for.
http://developer.apple.com/library/ios/#documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingLocalAndPushNotifications.html#//apple_ref/doc/uid/TP40011195-CH3-SW1
@dannycabrera
dannycabrera / iOS URL scheme index
Created September 27, 2013 15:44
iOS URL scheme index
http://handleopenurl.com & http://www.wiki.akosma.com/IPhone_URL_Schemes#Phone
tel - telephone (http://handleopenurl.com/scheme/phone)
html ex: <a href="tel:0031204637000">Call us</a>
native ex1: tel:0031204637000
native ex2: telprompt:##########
Apple Settings App (http://handleopenurl.com/scheme/apple-settings-app)
native ex: prefs:root=General&path=Bluetooth
html ex: <a href="prefs:root=AIRPLANE_MODE">Switch to airplane mode</a>
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Threading.Tasks;
namespace BasicTable {
public class TableSource : UITableViewSource {
protected string[] tableItems;
protected string cellIdentifier = "TableCell";
@dannycabrera
dannycabrera / Xamarin.iOS Get system version
Created October 3, 2013 14:22
Xamarin.iOS check for system version iOS 7
int SystemVersion = Convert.ToInt16(UIDevice.CurrentDevice.SystemVersion.Split ('.') [0].ToString ());
if (SystemVersion >= 7) {
this.EdgesForExtendedLayout = UIRectEdge.None;
this.AutomaticallyAdjustsScrollViewInsets = false;
this.ExtendedLayoutIncludesOpaqueBars = false;
}
or