public void GetCurrentLocationWebCall()
 {
     LocationManager locationmanager = new LocationManager ();
     locationmanager.GetPosition (GetCurrentLocationWebCallResponds);
 }
Beispiel #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.home);

            global::Xamarin.Facebook.FacebookSdk.SdkInitialize (this);
            facebookcallbackmanager = global::Xamarin.Facebook.CallbackManagerFactory.Create();

            SocialShareAndroid soccialandroid = new SocialShareAndroid (this);

            //try to get location
            this.rootlayout=(RelativeLayout)FindViewById (Resource.Id.rootlayout);

            locationmanager = new LocationManager ();

            IntentFilter intetnfilter = new IntentFilter ();
            intetnfilter.AddAction (Intent.ActionScreenOff);
            intetnfilter.AddAction (Intent.ActionScreenOn);
            RegisterReceiver (new ScreenUnlockReceiver(this),intetnfilter);

            IntentFilter smsfilter = new IntentFilter ();
            smsfilter.AddAction ("SMS_SENT");
            smsfilter.AddAction ("SMS_RECEIVED");

            SmsMessagekReceiver smsreceiver = new SmsMessagekReceiver (this);
            RegisterReceiver (smsreceiver,smsfilter);

            SmsMessageDelieveredReceiver smsdelieveredreceiver = new SmsMessageDelieveredReceiver (this);
            RegisterReceiver (smsdelieveredreceiver,smsfilter);

            AddSpinner (RaffleListScreenData.LoadingScreenTextLocation);

            locationmanager.GetPosition ((Tap5050WebResponse response) => {

                if (response.available) {
                    RunOnUiThread(()=>{
                        RemoveSpinner ();
                    });
                    var position=(GeonamesCountry)response.parsedobject;
                    GlobalVariable.currentlocation=position.adminName1;

                    //if it is first time login
                    UsernameTableObject obj=App.INSTANCE.databasemanager.GetUsername(GlobalVariable.username);

                    //if first time login show fragment
                    if (obj!=null&&obj.HaveLogged == 0) {
                        ShowTutorialFragment(0);
                        App.INSTANCE.databasemanager.SetLogged (GlobalVariable.username);
                    }
                    else{
                        InitialFragment(GlobalVariable.currentlocation);
                    }
                } else {
                    GetAvailableProvince();
                }
            });
            //			GetAvailableProvince();
        }