listFiles command not return new image

I’m working in an application using ricoh api v2.1 and i’m programming with xamarin forms (C#, .NET).
I got a problem with theta V, I used listFiles command ( and by default it return a list of still image files sorted by newest.
I noticed that when I used a new theta V device, listFiles return to me the bad picture (not the newest) because date is not the good one.

Here is an image with my capture in ricoh theta device. As you can see, R0010004.JPG is not the last picture but in my case I took this picture at the end. Using listFiles it return to me R00100003.JPG.

It is an issue with theta configuration or with listFiles ? Is there a way to sort by name ?

I do not think you can sort by name. I believe you can only sort by “newest” or “oldest”.

I may not understand your question, so please ask again if this does not help. However, I am using the listFiles to get the last image taken.




The code below reliably gives me the last file taken.

import 'dart:convert';
import 'package:http/http.dart' as http;

Future<String> getLastImageUrl() async {

  var url ='';

  Map data = {
    'name': 'camera.listFiles',
    'parameters': {
      'fileType': 'image',
      'entryCount': 1,
      'maxThumbSize': 0
  //encode Map to JSON
  var body = jsonEncode(data);

  var response = await,
      headers: {"Content-Type": "application/json;charset=utf-8"},
      body: body

  Map<String, dynamic> thetaImage = jsonDecode(response.body);

  // test data
  // final testFileUrl = '';

  String imageFileUrl = thetaImage['results']['entries'][0]['fileUrl'];
  return imageFileUrl;

Waiting for Process to Finish

If you are taking the picture, then listing it, you may need to wait for the takePicture process to return a ready status.

Example of checking camera status

Note that the example below is using the status command to check to make sure the camera is ready for the next command.

import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:imagetest/pretty_print.dart';
import 'package:imagetest/take_picture.dart';

Future<String> isDone(String id) async {
  var url ='';
  Map data = {
    'id': id

  var payload = jsonEncode(data);

  var response = await,
      headers: {"Content-Type": "application/json;charset=utf-8"},
      body: payload

  Map<String, dynamic> status = jsonDecode(response.body);
  String state = status['state'];

  return state;


Future<String> downloadReady () async {

  print("Test of taking picture and then checking to see if picture is ready for download");
  var takePictureResponse = await takePicture();
  // print(takePictureResponse);
  Map<String, dynamic> pictureInfo = jsonDecode(takePictureResponse.body);
  String id = pictureInfo['id'];
  print('The status ID is $id');

  bool keepGoing = true;
  int elapsedSeconds = 0;

  while (keepGoing) {
    var currentStatus = await isDone(id);
    // print(currentStatus);

    await new Future.delayed(const Duration(seconds: 1));
    print("Elapsed time: $elapsedSeconds seconds. State: $currentStatus");
    if (currentStatus == "done") {
      keepGoing = false;

  print("picture ready for download");
  return 'ready';


I/flutter (20524): Test of taking picture and then checking to see if picture is ready for download
I/flutter (20524): ---
I/flutter (20524): The HTTP response code is: 200
I/flutter (20524): The HTTP response from camera.takePicture is:
I/flutter (20524): {
I/flutter (20524):   "name": "camera.takePicture",
I/flutter (20524):   "id": "269",
I/flutter (20524):   "progress": {
I/flutter (20524):     "completion": 0.0
I/flutter (20524):   },
I/flutter (20524):   "state": "inProgress"
I/flutter (20524): }
I/flutter (20524): The status ID is 269
I/flutter (20524): Elapsed time: 0 seconds. State: inProgress
I/flutter (20524): Elapsed time: 1 seconds. State: inProgress
I/flutter (20524): Elapsed time: 2 seconds. State: inProgress
I/flutter (20524): Elapsed time: 3 seconds. State: inProgress
I/flutter (20524): Elapsed time: 4 seconds. State: inProgress
I/flutter (20524): Elapsed time: 5 seconds. State: inProgress
I/flutter (20524): Elapsed time: 6 seconds. State: inProgress
I/flutter (20524): Elapsed time: 7 seconds. State: done
I/flutter (20524): picture ready for download
I/flutter (20524): Image is available at thi URL
I/flutter (20524):

Thank’s for your reply, I don’t understand why date is set to 2017 (check screen shot). The date is not the good one, If it’s not possible to sort by name, is it possible to change date. In my program I used setOptions with DateTimeZone param

When you use getOptions on your camera to see the DateTimeZone that it sets, does it return the correct date? If it doesn’t, your camera/phone combination is not acting with the expected behavior. Can you use the RICOH official mobile app as a test to take pictures and check if the camera internal time is set properly?

I tried what you tell me. I took another picture with ricoh app then with my app and it work’s well but I don’t understand why. I would like to set the good date like ricoh app to avoid to use ricoh app each first time.
I hope you understand what I mean. Thank’s a lot @craig

With your app, the format of your camera.setOptions may be incorrect.

Using the API below, run a check to either your log, a print statement to your console, or a debugger.

Verify the following:

  1. http response code is 200
  2. use getOptions to confirm that the time was actually set to the value you specfied

I suspect that either the time format is incorrect or that there could be a bug in the API documentation.

Note that I have not actually tried this myself.

The format in the API documentation is:

2014:05:18 01:04:29+08:00

You can try setting it to a different timezone and time manually as a test and first see if the API works.

excuse me @craig for my late reply, I notice issue appear with new ricoh theta V device. I received new device and all pictures taken from my app don’t have good date in metadata. When I use officail ricoh app , date is synchronized successfully. I will see getOptions value. Thanks a lot

1 Like