Skip to content

Instantly share code, notes, and snippets.

@Haosvit
Last active July 12, 2016 04:07
Show Gist options
  • Save Haosvit/69f5e52d92d8b4e5c62195253f96485e to your computer and use it in GitHub Desktop.
Save Haosvit/69f5e52d92d8b4e5c62195253f96485e to your computer and use it in GitHub Desktop.

@drool said: Documentation can be found here: https://components.xamarin.com/gettingstarted/googleiosgcm but I failed when tried to set DeviceToken as a value for key Constants.RegisterAPNSOption. Has anyone succeeded?

The document has error.

var options = new NSDictionary();
change to
var options = new NSMutableDictionary();

SendUpStream

public void SendUpstreamMessage()
		{
			var msg = new NSMutableDictionary();
			msg.SetValueForKey(new NSString("1234"), new NSString("userId"));
			msg.SetValueForKey(new NSString("hello world"), new NSString("msg"));

			var to = GCM_SENDER_ID + "@gcm.googleapis.com";

			Service.SharedInstance.SendMessage(msg, to, (_messageId++).ToString());
		}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment