Particle Electron, subscribing to events using the android sdk

Hey guys, so i ran the example app and it worked fine. I added an extra textview to the ValueActivity to display a message if an event is sent. This is my source code below. Currently i am having trouble with subscribing to the event as the textview does not change once the event occurs. I checked on the cloud, the event is occuring and it is public. Any help would be good.



public class ValueActivity extends AppCompatActivity {

private static final String ARG_VALUE = "ARG_VALUE";
private static final String ARG_DEVICEID = "ARG_DEVICEID";
private static String TAG;
private TextView tv;
private TextView testing;

protected void onCreate(Bundle savedInstanceState) {
    tv = findViewById(;

    testing = (TextView)findViewById(;
    tv.setText(String.valueOf(getIntent().getIntExtra(ARG_VALUE, 0)));
    testing.setText(String.valueOf(getIntent().getIntExtra(ARG_VALUE, 0)));

    findViewById( -> {
        // Do network work on background thread
        Async.executeAsync(ParticleCloudSDK.getCloud(), new Async.ApiWork<ParticleCloud, Object>() {
            public Object callApi(@NonNull ParticleCloud ParticleCloud) throws ParticleCloudException, IOException {
                ParticleDevice device = ParticleCloud.getDevice(getIntent().getStringExtra(ARG_DEVICEID));
                Object variable;
                long subscriptionId;  // save this for later, for unsubscribing

                try {
                    variable = device.getDoubleVariable("charles");
                } catch (ParticleDevice.VariableDoesNotExistException e) {
                    Toaster.l(ValueActivity.this, e.getMessage());
                    variable = -1;
                return variable;

            public void onSuccess(@NonNull Object i) { // this goes on the main thread

            public void onFailure(@NonNull ParticleCloudException e) {

            public String doInBackground(Void... params) {
                try {
                    // Subscribe to an event
                    long subscriptionId = ParticleCloudSDK.getCloud().subscribeToDeviceEvents("beamStatus","------------",
                            new ParticleEventHandler() {
                                public void onEvent(String eventName, ParticleEvent particleEvent) {
                                    //testing is the textview id

                                public void onEventError(Exception e) {
                                    Log.e(TAG, "Event error: ", e);
                    return "Subscribed!";
                catch(IOException e) {
                    // We end up here if there was an error subscribing
                    Log.e(TAG, e.toString());
                    return "Error subscribing!";



Let me ping someone that might be able to help, @blave are you able to assist?

Thanks Kyle.