The official RICOH documentation for broadcast intents can be daunting for new plug-in developers.
To push a button, this is the documentation
If you look up the official Android documentation on intents, it can also be confusing.
The information is there, but it’s not friendly for people new to Android development.
Tip: Supplement the Documentation on Broadcast Intent With the pluginlibrary
First, if you use the thetapluginlibrary, you can use easier library calls to control the LEDs and buttons.
Easy Example
notificationLed3Show(LedColor.YELLOW);
This is easier than the Intent example
Intent Example
// this is not needed
Intent led3Intent = new Intent("com.theta360.plugin.ACTION_LED_SHOW");
led3Intent.putExtra("target", LedTarget.LED3.toString());
led3Intent.putExtra("color", LedColor.MAGENTA.toString());
sendBroadcast(led3Intent);
The example using an Intent duplicates the pluginlibrary method notificationLed3Show
. It’s easier to use the library.
Easy Example
setAutoClose(true);
Intent Example
The packageName org.codecakes.broadcastintent
is the package of the project I created. This your unique project, the one you are building.
@Override
protected void onDestroy() {
super.onDestroy();
// not needed
Intent finishIntent = new Intent("com.theta360.plugin.ACTION_FINISH_PLUGIN");
finishIntent.putExtra("packageName", "org.codecakes.broadcastintent");
finishIntent.putExtra("exitStatus", "success");
sendBroadcast(finishIntent);
}
Once you figure out the basic syntax of the broadcast intent, it’s straighforward to implement.
Close Camera
To use the CameraAPI, you’ll need to close the main RICOH camera app.
Intent closeCameraIntent = new Intent("com.theta360.ACTION_MAIN_CAMERA_CLOSE");
sendBroadcast(closeCameraIntent);
Open Camera
You need to send control back to the camera.
@Override
protected void onPause() {
super.onPause();
Intent openCameraIntent = new Intent("com.theta360.plugin.ACTION_CAMERA_OPEN");
sendBroadcast(openCameraIntent);
}
Minimal Code Example
Jump to the good stuff.