protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button>(Resource.Id.MyButton); button.Click += delegate { Android.Net.ConnectivityManager connectivityManager = (Android.Net.ConnectivityManager)GetSystemService(ConnectivityService); Android.Net.NetworkInfo activeConnection = connectivityManager.ActiveNetworkInfo; bool isOnline = (activeConnection != null) && activeConnection.IsConnected; if (isOnline == false) { Toast.MakeText(this, "Network Not Enable", ToastLength.Long).Show(); } else { LocationManager mlocManager = (LocationManager)GetSystemService(LocationService);; bool enabled = mlocManager.IsProviderEnabled(LocationManager.GpsProvider); if (enabled == false) { Toast.MakeText(this, "GPS Not Enable", ToastLength.Long).Show(); } } }; }
public static void ExecuteNetworkCommand(ExecuteNetworkDelegate command, object connManager) { #if Android if (Android.OS.Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.Lollipop) { command(); return; } Android.Net.Network bindNetwork = null; Android.Net.ConnectivityManager connectivityManager = connManager as Android.Net.ConnectivityManager; // ReSharper disable once UseNullPropagation if (connectivityManager != null) { Android.Net.Network[] networks = connectivityManager.GetAllNetworks(); if (networks != null) { foreach (Android.Net.Network network in networks) { Android.Net.NetworkInfo networkInfo = connectivityManager.GetNetworkInfo(network); Android.Net.NetworkCapabilities networkCapabilities = connectivityManager.GetNetworkCapabilities(network); // HasTransport support started also with Lollipop if (networkInfo != null && networkInfo.IsConnected && networkCapabilities != null && networkCapabilities.HasTransport(Android.Net.TransportType.Wifi)) { bindNetwork = network; break; } } } } if (Android.OS.Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.M) { #pragma warning disable 618 Android.Net.Network defaultNetwork = Android.Net.ConnectivityManager.ProcessDefaultNetwork; try { Android.Net.ConnectivityManager.SetProcessDefaultNetwork(bindNetwork); command(); } finally { Android.Net.ConnectivityManager.SetProcessDefaultNetwork(defaultNetwork); } #pragma warning restore 618 return; } Android.Net.Network boundNetwork = connectivityManager?.BoundNetworkForProcess; try { connectivityManager?.BindProcessToNetwork(bindNetwork); command(); } finally { connectivityManager?.BindProcessToNetwork(boundNetwork); } #else command(); #endif }
private void Tv_Subway_Click(object sender, EventArgs e) { TextView t = sender as TextView; if (t != null) { Android.Net.ConnectivityManager connectivityManager = (Android.Net.ConnectivityManager)GetSystemService(ConnectivityService); Android.Net.NetworkInfo activeConnection = connectivityManager.ActiveNetworkInfo; bool isOnline = (activeConnection != null) && activeConnection.IsConnected; if (isOnline) { var second = new Intent(this, typeof(SubwayInfoActivity)); second.PutExtra("StationName", t.Tag.ToString().Split(',')[0]); this.StartActivity(second); } else { AlertDialog.Builder dlg = new AlertDialog.Builder(this); dlg.SetTitle(GetString(Resource.String.InternetCheck)); dlg.SetMessage(GetString(Resource.String.InternetCheckMessage)); dlg.SetIcon(Resource.Drawable.AppIcon); dlg.SetPositiveButton(GetString(Resource.String.confirm), (s, o) => { }); dlg.Show(); } } }
public static bool VerifyInternetAccess(this Activity activity) { Android.Net.ConnectivityManager connectivityManager = (Android.Net.ConnectivityManager)activity.GetSystemService("connectivity"); Android.Net.NetworkInfo activeConnection = connectivityManager.ActiveNetworkInfo; bool isOnline = (activeConnection != null) && activeConnection.IsConnected; return(isOnline); }
public static bool DetectNetwork(Activity activity) { //var activity = this.Context as Activity; //public static bool DetectNetwork() //{ Android.Net.ConnectivityManager connectivityManager = (Android.Net.ConnectivityManager)activity.GetSystemService(Activity.ConnectivityService); Android.Net.NetworkInfo activeConnection = connectivityManager.ActiveNetworkInfo; //Usado apenas para analisar todos os tipos de conexao. //Android.Net.NetworkInfo[] activeConnection1 = connectivityManager.GetAllNetworkInfo();//.ActiveNetworkInfo; bool isOnline = (activeConnection != null) && activeConnection.IsConnected; if (isOnline) { // Display the type of connection //Android.Net.NetworkInfo.State activeState = activeConnection.GetState (); //_connectionType.Text = activeConnection.TypeName; // Check for a WiFi connection Android.Net.NetworkInfo wifiInfo = connectivityManager.GetNetworkInfo(Android.Net.ConnectivityType.Wifi); if (wifiInfo.IsConnected) { //Wifi connected return(true); } else { //Wifi disconnected // Check if roaming or mobile Android.Net.NetworkInfo mobileInfo = connectivityManager.GetNetworkInfo(Android.Net.ConnectivityType.Mobile); if (mobileInfo.IsRoaming || mobileInfo.IsConnected) { //roaming or mobile connected. return(true); } else { //roaming or mobile disconnected return(false); } } } else { return(false); } }
//Check the connection public static Boolean isNetworkStatusAvialable(Context context) { Android.Net.ConnectivityManager connectivityManager = (Android.Net.ConnectivityManager)context.GetSystemService(Context.ConnectivityService); if (connectivityManager != null) { Android.Net.NetworkInfo netInfos = connectivityManager.ActiveNetworkInfo; if (netInfos != null) { if (netInfos.IsConnected) { return(true); } } } return(false); }
private void BTN_EVENT_Click(object sender, EventArgs e) { Android.Net.ConnectivityManager connectivityManager = (Android.Net.ConnectivityManager)GetSystemService(ConnectivityService); Android.Net.NetworkInfo activeConnection = connectivityManager.ActiveNetworkInfo; bool isOnline = (activeConnection != null) && activeConnection.IsConnected; if (isOnline) { StartActivity(typeof(EventLoadingActivity)); } else { AlertDialog.Builder dlg = new AlertDialog.Builder(this); dlg.SetTitle(GetString(Resource.String.InternetCheck)); dlg.SetMessage(GetString(Resource.String.InternetCheckMessage)); dlg.SetIcon(Resource.Drawable.AppIcon); dlg.SetPositiveButton(GetString(Resource.String.confirm), (s, o) => { }); dlg.Show(); } }
private void LoadAndPopulate() { CurrentMode = (Mode)Intent.GetIntExtra("Mode", (int)Mode.Create); string uid = Intent.GetStringExtra("FormUID"); mguidFormUID = Guid.Parse(uid); if (Sketch == null) { Sketch = new WcfService.SerialisablePhotoThumbnail() { }; } try { ctlSurveySheetRoom.mFormUID = mguidFormUID; ctlSurveySheetRoom.LoadData(LoggedInUser, mguidFormUID); ctlSurveySheetRoom.OnDataLoaded(); } catch (Exception ex) { new AlertDialog.Builder(this) .SetIcon(Resource.Drawable.Icon) .SetTitle("Item list could not be loaded.") .SetMessage("An unexpected error occurred and the list of items on the form could not be loaded") .SetNeutralButton("OK.", (sender, args) => { }) .Show(); } btnUpload.Enabled = false; Android.Net.ConnectivityManager mngrCheckConnectivity = (Android.Net.ConnectivityManager)GetSystemService(Context.ConnectivityService); Android.Net.NetworkInfo CheckActiveConnection = mngrCheckConnectivity.ActiveNetworkInfo; if (CheckActiveConnection != null) { btnUpload.Enabled = true; } //load and populate here for edit and view modes if (CurrentMode != Mode.Create) { ModeSwitch.Visibility = ViewStates.Visible; btnDelete.Visibility = ViewStates.Visible; mobjForm = new BusinessLogic.SurveySheet(); mobjForm.Load(mguidFormUID); txtSheetName.Text = mobjForm.SheetName; txtDate.Text = mobjForm.Date != DateTime.MinValue ? mobjForm.Date.ToShortDateString() : string.Empty; txtJobNumber.Text = mobjForm.JobNumber; txtAddress.Text = mobjForm.Address; txtClient.Text = mobjForm.Client; txtSurveyor.Text = mobjForm.Surveyor; txtTotalSamplesTaken.Text = mobjForm.TotalSamplesTaken.ToString(); txtReasonForSurvey.Text = mobjForm.ReasonForSurvey; txtWater.Text = mobjForm.Water; txtPower.Text = mobjForm.Power; txtParking.Text = mobjForm.Parking; txtGeneralComments.Text = mobjForm.GeneralComments; if (mobjForm.SketchPath != null || !string.IsNullOrWhiteSpace(mobjForm.SketchPath)) { Sketch.UriPath = mobjForm.SketchPath; var uriImage = Code.URI.FromPath(Sketch.UriPath); imgSketch.SetImageAutoScale(uriImage.GetImage(this)); } switchMode(CurrentMode); } else { txtSheetName.Text = "Survey Sheet - " + LoggedInUser.Name; txtDate.Text = DateTime.Now.ToShortDateString(); } }
public override bool ShouldRetry(bool airplaneMode, Android.Net.NetworkInfo info) { return(info == null || info.IsConnectedOrConnecting); }
private void HandleEvents() { Submit sub = new Submit(); sub.id = FillUpActivity.rId; sub.date = DateTime.Now; sub.survey1 = Survey1Activity.survey1; sub.survey2 = Survey2Activity.survey2; sub.survey3 = new string[] { Survey3Activity.survey3q1, Survey3Activity.survey3q2, Survey3Activity.survey3q3, Survey3Activity.survey3q4, Survey3Activity.survey3q5, Survey3Activity.survey3q6 }; sub.survey4 = Survey4Activity.survey4; sub.survey5 = new string[] { Survey5Activity.survey5q1, Survey5Activity.survey5q2 }; sub.survey6 = Survey6Activity.survey6; sub.survey7 = new string[] { Survey7Activity.survey7q1, Survey7Activity.survey7q2, Survey7Activity.survey7q3 }; sub.survey8 = Survey8Activity.survey8.ToArray(); sub.survey9 = Survey9Activity.survey9; sub.survey10 = new s10 { gender = Survey10Activity.survey10q1, age = Survey10Activity.survey10q2, living = Survey10Activity.survey10q3, income = Survey10Activity.survey10q4, background = Survey10Activity.survey10q5 }; btnExit.Click += async delegate { Android.Net.ConnectivityManager connectivityManager = (Android.Net.ConnectivityManager)GetSystemService(ConnectivityService); Android.Net.NetworkInfo activeConnection = connectivityManager.ActiveNetworkInfo; bool isOnline = (activeConnection != null) && activeConnection.IsConnected; if (isOnline == false) { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("No Connection"); alert.SetMessage("Please check your internet connection and try again."); alert.SetButton("OK", (c, ev) => { alert.Hide(); }); alert.Show(); } else { btnExit.Enabled = false; HttpClient client = new HttpClient(); string url = "https://jsonblob.com/api/jsonBlob/7367dcc3-c852-11e8-8a99-ad6b1022dc2b"; var uri = new Uri(url); HttpResponseMessage response; client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var json = JsonConvert.SerializeObject(sub); JArray array = JArray.Parse(EvalSystemActivity.prev); JObject obj = JObject.Parse(json); array.Add(new JObject(obj)); var merge = JsonConvert.SerializeObject(array); Main.test = merge; var content = new StringContent(merge, Encoding.UTF8, "application/json"); response = await client.PutAsync(uri, content); /* * * try * { * Toast.MakeText(this, "yes!", ToastLength.Short).Show(); * messageToSend = "shit!"; * SmtpClient sclient = new SmtpClient("smtp.gmail.com", 456); * MailMessage message = new MailMessage(); * message.From = new MailAddress("*****@*****.**"); //Who it's from * message.To.Add("*****@*****.**"); // The E-Mail that recieves the message * message.Subject = "Replay from PC"; * message.Body = messageToSend; * sclient.EnableSsl = true; * sclient.UseDefaultCredentials = false; * sclient.Credentials = new NetworkCredential("Hazhard Waryeah", "Astigako1234"); * sclient.Send(message); * } * catch * { * Toast.MakeText(this, "error!", ToastLength.Short).Show(); * } */ // var activity = (Activity)this; // activity.FinishAffinity(); } }; }
public static void ExecuteNetworkCommand(ExecuteNetworkDelegate command, object connManager, bool checkEthernet = false) { #if Android if (Android.OS.Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.Lollipop) { command(); return; } Android.Net.Network bindNetwork = null; Android.Net.ConnectivityManager connectivityManager = connManager as Android.Net.ConnectivityManager; // ReSharper disable once UseNullPropagation if (connectivityManager != null) { Android.Net.Network[] networks = connectivityManager.GetAllNetworks(); if (networks != null) { foreach (Android.Net.Network network in networks) { Android.Net.NetworkInfo networkInfo = connectivityManager.GetNetworkInfo(network); Android.Net.NetworkCapabilities networkCapabilities = connectivityManager.GetNetworkCapabilities(network); // HasTransport support started also with Lollipop if (networkInfo != null && networkInfo.IsConnected && networkCapabilities != null) { bool linkValid = false; bool autoIp = false; Android.Net.LinkProperties linkProperties = connectivityManager.GetLinkProperties(network); foreach (Android.Net.LinkAddress linkAddress in linkProperties.LinkAddresses) { if (linkAddress.Address is Java.Net.Inet4Address inet4Address) { if (inet4Address.IsSiteLocalAddress || inet4Address.IsLinkLocalAddress) { linkValid = true; autoIp = inet4Address.IsLinkLocalAddress; break; } } } if (linkValid) { if (networkCapabilities.HasTransport(Android.Net.TransportType.Wifi)) { bindNetwork = network; } if (checkEthernet && networkCapabilities.HasTransport(Android.Net.TransportType.Ethernet)) { if (autoIp) { // prefer Ethernet auto ip bindNetwork = network; break; } if (bindNetwork == null) { // prefer Wifi bindNetwork = network; } } } } } } } if (Android.OS.Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.M) { #pragma warning disable 618 Android.Net.Network defaultNetwork = Android.Net.ConnectivityManager.ProcessDefaultNetwork; try { Android.Net.ConnectivityManager.SetProcessDefaultNetwork(bindNetwork); command(); } finally { Android.Net.ConnectivityManager.SetProcessDefaultNetwork(defaultNetwork); } #pragma warning restore 618 return; } Android.Net.Network boundNetwork = connectivityManager?.BoundNetworkForProcess; try { connectivityManager?.BindProcessToNetwork(bindNetwork); command(); } finally { connectivityManager?.BindProcessToNetwork(boundNetwork); } #else command(); #endif }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (MainActivity.Activities.ContainsKey("ShopInfoActivity")) { MainActivity.Activities["ShopInfoActivity"].Finish(); MainActivity.Activities.Remove("ShopInfoActivity"); MainActivity.Activities.Add("ShopInfoActivity", this); } else { MainActivity.Activities.Add("ShopInfoActivity", this); } // Create your application here SetContentView(Resource.Layout.ShopInfoLayout2); shopID = Intent.GetStringExtra("SHOP_ID_NUMBER"); local = Intent.GetStringExtra("Local"); ShopDBInformation DBShopContext = null; if (Data_ShopInfo.DIC_SHOP_DB_INFO_OVERALL_INFO.ContainsKey(shopID)) { DBShopContext = Data_ShopInfo.DIC_SHOP_DB_INFO_OVERALL_INFO[shopID]; } else { ShopDBInformation shopData = new ShopDBInformation() { BookMark = 0, Comment = "", Rating = 0f, IdentificationNumber = shopID }; Data_ShopInfo.DIC_SHOP_DB_INFO_OVERALL_INFO.Add(shopData.IdentificationNumber, shopData); DBShopContext = Data_ShopInfo.DIC_SHOP_DB_INFO_OVERALL_INFO[shopID]; Data_ShopInfo.InsertShopInfoData(shopData); } ShopInformation XMLShopContext = Data_ShopInfo.DIC_SHOP_XML_INFO_OVERALL_INFO[shopID]; TextView tv_ShopName = FindViewById <TextView>(Resource.Id.tv_ShopName); tv_ShopName.Text = XMLShopContext.ShopName; TextView tv_ShopAddress = FindViewById <TextView>(Resource.Id.tv_ShopAddress); tv_ShopAddress.Text = XMLShopContext.LocalNam; TextView tv_SaleKind = FindViewById <TextView>(Resource.Id.tv_SaleKind); tv_SaleKind.Text = XMLShopContext.Category; RatingBar ratingbar = FindViewById <RatingBar>(Resource.Id.ratingbar); ratingbar.Rating = DBShopContext.Rating; ratingbar.RatingBarChange += (o, e) => { Toast.MakeText(this, "New Rating: " + ratingbar.Rating.ToString(), ToastLength.Short).Show(); DBShopContext.Rating = ratingbar.Rating; Data_ShopInfo.SHOP_DB.UpdateShopData("Rating", DBShopContext.Rating, DBShopContext.IdentificationNumber); }; RatingBar bookmark = FindViewById <RatingBar>(Resource.Id.BookMark); bookmark.Rating = DBShopContext.BookMark; bookmark.Touch += (o, e) => { if (e.Event.ActionMasked == MotionEventActions.Up) { count++; if (count % 2 == 0) { bookmark.Rating = 0; DBShopContext.BookMark = 0; Data_ShopInfo.SHOP_DB.UpdateShopData("BookMark", DBShopContext.BookMark, DBShopContext.IdentificationNumber); } else { bookmark.Rating = 1; DBShopContext.BookMark = 1; Data_ShopInfo.SHOP_DB.UpdateShopData("BookMark", DBShopContext.BookMark, DBShopContext.IdentificationNumber); } } }; EditText et = FindViewById <EditText>(Resource.Id.et_comment); et.Text = DBShopContext.Comment.ToString(); et.TextChanged += (o, e) => { DBShopContext.Comment = et.Text; Data_ShopInfo.SHOP_DB.UpdateShopData("Comment", DBShopContext.Comment, DBShopContext.IdentificationNumber); }; int tweetcount = ("#" + XMLShopContext.ShopName + "(#" + XMLShopContext.LocalNam + GetString(Resource.String.UnderShopdddd) + "\n" + GetString(Resource.String.SaleKind) + " " + XMLShopContext.Category + "\n" + GetString(Resource.String.MyRating) + " " + ratingbar.Rating.ToString() + "\n" + GetString(Resource.String.MyComment) + " ").Length; global::Android.Text.IInputFilter[] fA = new Android.Text.IInputFilter[1]; fA[0] = new Android.Text.InputFilterLengthFilter(139 - tweetcount); et.SetFilters(fA); LinearLayout twit_sharing = FindViewById <LinearLayout>(Resource.Id.twit_sharing); LinearLayout twit_others_opinion = FindViewById <LinearLayout>(Resource.Id.twit_others_opinion); twit_sharing.Click += (o, e) => { Android.Net.ConnectivityManager connectivityManager = (Android.Net.ConnectivityManager)GetSystemService(ConnectivityService); Android.Net.NetworkInfo activeConnection = connectivityManager.ActiveNetworkInfo; bool isOnline = (activeConnection != null) && activeConnection.IsConnected; if (isOnline) { if (loggedInAccount == null) { Toast.MakeText(this, GetString(Resource.String.acquireLogin), ToastLength.Short).Show(); var auth = new OAuth1Authenticator( consumerKey: "qjXcnuCmZKPLU9Mupr0nkEcCv", consumerSecret: "q3c4nxTk1jqsLowujLxTmugsmdaLZFVq5cLI4SmWA1pRSlPcaD", requestTokenUrl: new Uri("https://api.twitter.com/oauth/request_token"), authorizeUrl: new Uri("https://api.twitter.com/oauth/authorize"), accessTokenUrl: new Uri("https://api.twitter.com/oauth/access_token"), callbackUrl: new Uri("http://www.hansei.ac.kr/")); //save the account data in the authorization completed even handler auth.Completed += (sender, eventArgs) => { if (eventArgs.IsAuthenticated) { loggedInAccount = eventArgs.Account; AccountStore.Create(this).Save(loggedInAccount, "UndertheShopTwitApp"); var cred = new LinqToTwitter.InMemoryCredentialStore(); cred.ConsumerKey = loggedInAccount.Properties["oauth_consumer_key"]; cred.ConsumerSecret = loggedInAccount.Properties["oauth_consumer_secret"]; cred.OAuthToken = loggedInAccount.Properties["oauth_token"]; cred.OAuthTokenSecret = loggedInAccount.Properties["oauth_token_secret"]; var auth0 = new LinqToTwitter.PinAuthorizer() { CredentialStore = cred, }; var TwitterCtx = new LinqToTwitter.TwitterContext(auth0); TwitterCtx.TweetAsync("#" + XMLShopContext.ShopName + "(#" + XMLShopContext.LocalNam + GetString(Resource.String.UnderShopdddd) + "\n" + GetString(Resource.String.SaleKind) + " " + XMLShopContext.Category + "\n" + GetString(Resource.String.MyRating) + " " + ratingbar.Rating.ToString() + "\n" + GetString(Resource.String.MyComment) + " " + et.Text); Toast.MakeText(this, GetString(Resource.String.TwitSharingComment), ToastLength.Short).Show(); } }; auth.Error += (sender, eventArgs) => { Toast.MakeText(this, GetString(Resource.String.authfail), ToastLength.Short).Show(); var next = new Intent(this.ApplicationContext, typeof(ShopInfoActivity)); next.PutExtra("SHOP_ID_NUMBER", shopID); next.PutExtra("Local", local); StartActivity(next); Finish(); }; var ui = auth.GetUI(this); StartActivityForResult(ui, -1); } else { var cred = new LinqToTwitter.InMemoryCredentialStore(); cred.ConsumerKey = loggedInAccount.Properties["oauth_consumer_key"]; cred.ConsumerSecret = loggedInAccount.Properties["oauth_consumer_secret"]; cred.OAuthToken = loggedInAccount.Properties["oauth_token"]; cred.OAuthTokenSecret = loggedInAccount.Properties["oauth_token_secret"]; var auth0 = new LinqToTwitter.PinAuthorizer() { CredentialStore = cred, }; var TwitterCtx = new LinqToTwitter.TwitterContext(auth0); TwitterCtx.TweetAsync("#" + XMLShopContext.ShopName + "(#" + XMLShopContext.LocalNam + GetString(Resource.String.UnderShopdddd) + "\n" + GetString(Resource.String.SaleKind) + " " + XMLShopContext.Category + "\n" + GetString(Resource.String.MyRating) + " " + ratingbar.ToString() + "\n" + GetString(Resource.String.MyComment) + " " + et.Text); Toast.MakeText(this, GetString(Resource.String.TwitSharingComment), ToastLength.Short).Show(); } } else { AlertDialog.Builder dlg = new AlertDialog.Builder(this); dlg.SetTitle(GetString(Resource.String.InternetCheck)); dlg.SetMessage(GetString(Resource.String.InternetCheckMessage)); dlg.SetIcon(Resource.Drawable.AppIcon); dlg.SetPositiveButton(GetString(Resource.String.confirm), (s, o2) => { }); dlg.Show(); } }; twit_others_opinion.Click += (o, e) => { Android.Net.ConnectivityManager connectivityManager = (Android.Net.ConnectivityManager)GetSystemService(ConnectivityService); Android.Net.NetworkInfo activeConnection = connectivityManager.ActiveNetworkInfo; bool isOnline = (activeConnection != null) && activeConnection.IsConnected; if (isOnline) { if (loggedInAccount == null) { Toast.MakeText(this, GetString(Resource.String.acquireLogin), ToastLength.Short).Show(); var auth = new OAuth1Authenticator( consumerKey: "qjXcnuCmZKPLU9Mupr0nkEcCv", consumerSecret: "q3c4nxTk1jqsLowujLxTmugsmdaLZFVq5cLI4SmWA1pRSlPcaD", requestTokenUrl: new Uri("https://api.twitter.com/oauth/request_token"), authorizeUrl: new Uri("https://api.twitter.com/oauth/authorize"), accessTokenUrl: new Uri("https://api.twitter.com/oauth/access_token"), callbackUrl: new Uri("http://www.hansei.ac.kr/")); //save the account data in the authorization completed even handler auth.Completed += (sender, eventArgs) => { if (eventArgs.IsAuthenticated) { loggedInAccount = eventArgs.Account; AccountStore.Create(this).Save(loggedInAccount, "UndertheShopTwitApp"); } if (loggedInAccount != null) { var ne = new Intent(this, typeof(SearchTwitter)); ne.PutExtra("keyword", "#" + XMLShopContext.ShopName); StartActivity(ne); } else { Toast.MakeText(this, GetString(Resource.String.authfail), ToastLength.Short).Show(); var next = new Intent(this.ApplicationContext, typeof(ShopInfoActivity)); next.PutExtra("SHOP_ID_NUMBER", shopID); next.PutExtra("Local", local); StartActivity(next); Finish(); } }; var ui = auth.GetUI(this); StartActivityForResult(ui, -1); } else { var ne = new Intent(this, typeof(SearchTwitter)); ne.PutExtra("keyword", "#" + XMLShopContext.ShopName); ne.PutExtra("SHOP_ID_NUMBER", shopID); ne.PutExtra("Local", local); StartActivity(ne); } } else { AlertDialog.Builder dlg = new AlertDialog.Builder(this); dlg.SetTitle(GetString(Resource.String.InternetCheck)); dlg.SetMessage(GetString(Resource.String.InternetCheckMessage)); dlg.SetIcon(Resource.Drawable.AppIcon); dlg.SetPositiveButton(GetString(Resource.String.confirm), (s, o2) => { }); dlg.Show(); } }; //twit_sharing.Click += (o, e) => { Tweet("#" + shopContext.ShopName + "(#"+shopContext.LocalNam+ GetString(Resource.String.UnderShopdddd) + "\n" + // GetString(Resource.String.SaleKind) +" " + shopContext.Category + "\n" + // GetString(Resource.String.MyRating) + " " + myRate.ToString() + "\n" + // GetString(Resource.String.MyComment) + " " + tv.Text , "Nothing"); }; //twit_others_opinion.Click += (o, e) => { // var next = new Intent(this, typeof(OthersOpinionActivity)); // next.PutExtra("ShopName", shopContext.ShopName); // StartActivity(next); //}; LinearLayout shopLoca = FindViewById <LinearLayout>(Resource.Id.shopLoca); shopLoca.Click += ShopLoca_Click; }