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 / AppDelegate ReceivedRemoteNotification
Created March 25, 2014 19:32
AppDelegate ReceivedRemoteNotification Example
public override void ReceivedRemoteNotification (UIApplication application, NSDictionary userInfo)
{
processNotification(userInfo, false);
}
void processNotification(NSDictionary options, bool fromFinishedLaunching)
{
//Check to see if the dictionary has the aps key. This is the notification payload you would have sent
if (null != options && options.ContainsKey(new NSString("aps")))
{
@dannycabrera
dannycabrera / AppDelegate
Created December 5, 2013 04:39
AudioQueueOfflineRenderDemo AppDelegate test
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using MonoTouch;
using MonoTouch.AVFoundation;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
@dannycabrera
dannycabrera / Xamarin.iOS GetSSID
Created November 8, 2013 14:30
Xamarin.iOS GetSSID
public static string GetSSID(bool withMacAddress = true)
{
try {
NSDictionary dict;
var status = CaptiveNetwork.TryCopyCurrentNetworkInfo ("en0", out dict);
if (status == StatusCode.NoKey)
return "";
var bssid = dict [CaptiveNetwork.NetworkInfoKeyBSSID];
async void Demo ()
{
switch (await ShowAlert ("Title", "Message", "Ok", "Cancel")){
case 0: // Ok
....
case 1: // Cancel
....
}
}
@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
@dannycabrera
dannycabrera / gist:6802931
Created October 3, 2013 00:58
Xamarin.iOS URL schema to link to app's iTunes App Store page
UIApplication.SharedApplication.OpenUrl(new NSUrl("itms-apps://itunes.apple.com/app/idAPP_ID"))
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 / 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>
@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