Calling a photon function from android APP - Not working

Hi All,

I’m trying to call a photon function from my Android Application, but it is not working somehow.

Here’s the code,

try {

                            List<String> ledCommands = new ArrayList<String>();
                            ledCommands.add("on");
                            resultCode = mDevice.callFunction("ledToggle", ledCommands);
     } catch (ParticleDevice.FunctionDoesNotExistException e) {
                            e.printStackTrace();
     }
     Toaster.s(NoticeActivity.this, "Result of calling ledToggle: " + resultCode);

Note: mDevice is particle device which I have retrieved from getDevices(deviceID)

Can anyone help me with this?

Regards

What does your code on the device look like (especially the called function)?
is not working”, is not very specific. Does it timeout? Do you get an exception/error? What resultCode do you get (if any)?

How exactly did you use getDevice?

Did you get it working?

This line: resultCode = mDevice.callFunction(“ledToggle”, ledCommands);

Should be: resultCode = mDevice.callFunction(“led”, ledCommands);

The function or method is called ledToggle but when you create it with Particle.function(“led”,ledToggle); you need to reference the first argument “led”.