public override void OnCreate()
        {
            var options = AirshipConfigOptions.LoadDefaultOptions(this);

            // Optionally, customize your config
            options.InProduction         = false;
            options.DevelopmentAppKey    = "";
            options.DevelopmentAppSecret = "";

            UAirship.TakeOff(this, options);

            //use CustomPushNotificationBuilder to specify a custom layout
            CustomPushNotificationBuilder nb = new CustomPushNotificationBuilder();

            nb.StatusBarIconDrawableId = Resource.Id.icon;            //custom status bar icon

            nb.Layout = Resource.Layout.notification;
            nb.LayoutIconDrawableId = Resource.Id.icon;            //custom layout icon
            nb.LayoutIconId         = Resource.Id.icon;
            nb.LayoutSubjectId      = Resource.Id.subject;
            nb.LayoutMessageId      = Resource.Id.message;

            PushManager.Shared().NotificationBuilder  = nb;
            PushManager.Shared().IntentReceiver       = Class.FromType(typeof(IntentReceiver));
            UALocationManager.Shared().IntentReceiver = Class.FromType(typeof(IntentReceiver));
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.location);

            networkUpdateButton = (Button)FindViewById(Resource.Id.network_update_button);
            gpsUpdateButton     = (Button)FindViewById(Resource.Id.gps_update_button);

            locationFilter = new IntentFilter();
            locationFilter.AddAction(UALocationManager.ActionLocationUpdate);

            newCriteria          = new Criteria();
            newCriteria.Accuracy = Accuracy.Fine;

            networkUpdateButton.Click += delegate {
                try {
                    UALocationManager.Shared().RecordCurrentLocation();
                } catch (ServiceNotBoundException e) {
                    Logger.Debug(e.Message);
                } catch (RemoteException e) {
                    Logger.Debug(e.Message);
                }
            };

            gpsUpdateButton.Click += delegate {
                try {
                    UALocationManager.Shared().RecordCurrentLocation(newCriteria);
                } catch (ServiceNotBoundException e) {
                    Logger.Debug(e.Message);
                } catch (RemoteException e) {
                    Logger.Debug(e.Message);
                }
            };
        }