protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); ApplozicChatManager chatManager = new ApplozicChatManager(this); // Get our button from the layout resource, // and attach an event to it Button launchChatList = FindViewById <Button>(Resource.Id.launch_chat_list); Button launchOneToOneChat = FindViewById <Button>(Resource.Id.launch_one_to_one_chat); Button logout = FindViewById <Button>(Resource.Id.logout); launchChatList.Click += delegate { Log.Debug("ApplozicChat", "InstanceID token: " + FirebaseInstanceId.Instance.Token); chatManager.LaunchChatList(); }; launchOneToOneChat.Click += delegate { chatManager.LaunchChatWithUser("ak02"); }; logout.Click += delegate { UserLogoutListener logoutListener = new UserLogoutListener(); logoutListener.OnLogoutSucessHandler += (context) => { context.StartActivity(typeof(LoginActivity)); this.Finish(); }; chatManager.Logout(logoutListener); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); loginListener = new UserLoginListener(); loginListener.OnRegistrationSucessHandler += OnRegistrationSucessHandler; loginListener.OnRegistrationFailedHandler += OnRegistrationFailedHandler; // Set our view from the "main" layout resource SetContentView(Resource.Layout.login_activity_layout); // Get our button from the layout resource, // and attach an event to it userName = FindViewById <EditText>(Resource.Id.username_input); EditText password = FindViewById <EditText>(Resource.Id.password_input); Button signIn = FindViewById <Button>(Resource.Id.sign_in_btn); ApplozicChatManager chatManager = new ApplozicChatManager(this); signIn.Click += delegate { chatManager.RegisterUser(userName.Text, userName.Text, password.Text, loginListener); }; if (chatManager.ISUserLoggedIn()) { System.Console.WriteLine("Already Registred ::"); Intent myIntent = new Intent(this, typeof(MainActivity)); this.StartActivity(myIntent); this.Finish(); } }
public override void OnTokenRefresh() { var refreshedToken = FirebaseInstanceId.Instance.Token; Log.Debug(TAG, "Refreshed token: " + refreshedToken); ApplozicChatManager ChatManger = new ApplozicChatManager(this); ChatManger.SendRegistrationToServer(refreshedToken); }