I'm trying to track battery status, but I've been having a hard time getting the Java code for this properly converted to RubyMotion.
The following is how it works in Java
IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
Intent batteryStatus = context.registerReceiver(null, ifilter);
int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
float batteryPct = level / (float)scale;
Even just trying to get the
Intent.ACTION_BATTERY_CHANGED converted has proved problematic.