Ubidots Community

Android 4.4.4 ubidots api issues

Both the tutorial with the battery level and the android app for gps tracking do not post updates into the ubidots cloud. The tutorial app crashes with a “Receiver Not Registered” exception, the gps app from the play store attempts to post but then turns sendign updates off (maybe because internally it figures out something is not working).

Any advice on what might be the reason? I’m tempted as a workaround to not use the ubidots api library but do the http post requests myself.

@marcusbehrens we’ll check this first time monday.

Hi, Marcus!

Thanks for pointing out the error in the tutorial. I just saw I committed an error in the receiver registration, it shouldn’t be called in the onCreate method, but in the onStart method. I’m going to fix this error as fast as I can in the tutorial.

So, your onCreate method must become like:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mBatteryLevel = (TextView) findViewById(R.id.batteryLevel);
}

And there must be a new method (onStart) that should look like this:

protected void onStart() {
    super.onStart();
    registerReceiver(mBatteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
}

The problem you talk about the app in the Play Store. I haven’t been able to replicate it, I’ll keep looking what could be the problem.

Thanks so much again for contacting us.

I’ll keep in touch here if something.