Java Reference
In-Depth Information
the camera, set the camera flash on with red-eye reduction and set the
optical zoom:
p = Manager.createPlayer("capture://video");
p.realize();
p.start();
cameraControl = (CameraControl)
p.getControl("javax.microedition.amms.control.camera.CameraControl");
cameraControl.setExposureMode("night");
flashControl = (FlashControl)
p.getControl("javax.microedition.amms.control.camera.FlashControl");
flashControl.setMode(FlashControl.FORCE_WITH_REDEYEREDUCE);
focusControl = (FocusControl)
p.getControl("javax.microedition.amms.control.camera.FocusControl");
if (focusControl.isAutoFocusSupported()) {
focusControl.setFocus(FocusControl.AUTO);
} zoomControl = (ZoomControl)
p.getControl("javax.microedition.amms.control.camera.ZoomControl");
int maxOpticalZoom = zoomControl.getMaxOpticalZoom();
zoomControl.setOpticalZoom(maxOpticalZoom);
We get the current longitude and latitude location values using JSR-179
Location API:
// get location provider
LocationProvider locPvdr = LocationProvider.getInstance(null);
// get the current location
QualifiedCoordinates qc = locPvdr.getLocation().getQualifiedCoordinates();
double currentLongitude = qc.getLongitude();
double currentLatitude = qc.getLatitude();
In the MusicMate example, we used JSR-172 Web Services to
communicate with remote servers. If you are using a RESTful Web
Service, you could use simple HTTP requests and responses, 4
using
MIDP 2.0 HttpConnection . The URL is built as follows:
String restURL = "http://api.flickr.com/services/upload/?tag=";
...
url += currentLongitude;
url += currentLatitude;
An HTTP connection is opened to send the image:
HttpConnection hc = (HttpConnection)Connector.open(restURL);
hc.setRequestMethod(HttpConnection.POST);
4 www.en.wikipedia.org/wiki/REST
Search WWH ::




Custom Search