I am developing an android application. It has two types of users, a teacher and a student. I was hoping to use Shared Preferences to communicate between the two users.

Basically, I have a teach screen which has four TextViews on it with different messages. The TextView text is set to "" when the toggle value is 1 (which is the default value).

On the student screen, they have 4 Buttons. Upon hitting each button, the toggle value is changed to 0 and then the message is displayed on the teacher's view. This works when I log in as a student, click the button, then log in as a teacher. However, I want it to work on two different devices, so that when the student clicks the button the teacher sees the message.

Here are some code snippets:

Firstly, the student activity:

```
Assistance.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                toggleAssistance(view);
            }
        });

public void toggleAssistance(View view){
        SharedPreferences sharedPreferences = getSharedPreferences("requestToggles", Context.MODE_PRIVATE);

        SharedPreferences.Editor editor = sharedPreferences.edit();

        editor.putInt("assistanceToggle", 0);
        editor.apply();
    }

```

Secondly, the teacher activity:

```
asstToggle = sharedPreferences.getInt("assistanceToggle", 1);

if(asstToggle==1){
            Assistance.setText("");
            clearAssistance.setVisibility(View.GONE);
        }

```

Clear assistance is just a button that basically does the reverse of toggleAssistance (it sets the value to 1). No need for this button to be displayed when the message isn't.

Can anyone provide assistance or advice in to how I can make this work between devices? Thanks!