5

I'm trying to start using Quickblox, since it provides great tools for backend. I have registered on website an got credentials for my app, however I fail to start simple program to test connection:

public class MainActivity extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    QBSettings.getInstance().fastConfigInit("3504", "NMuekBBXBg6PgST", "HaOj5bY4LgxUpPH");

    QBAuth.createSession(new QBCallbackImpl() {
        @Override
        public void onComplete(Result result) {
            // result comes here
            // check if result success
            if (result.isSuccess()) {
                Toast.makeText(getApplicationContext(), "success!!", Toast.LENGTH_LONG).show();
            }else{
                Toast.makeText(getApplicationContext(), "fail :( " + result.getErrors(), Toast.LENGTH_LONG).show();
            }
        }
    }); 
} 

It works on AVD with Android 4.2.2 (API Level 17), however it fails on my galaxy s2 with 4.1.2 (API Level 16), with getErrors() returning "[base Bad timestamp]". I have no idea what I might be doing wrong, so any help would be appriciated. Please, don't make me switch to Parse :)

Valera
  • 423
  • 1
  • 6
  • 16

2 Answers2

10

This is typical developers error and it's easy to fix it.

Bad timestamp means that while Creating Session you sent invalid 'timestamp' value which is based on your phone time.

We suggest you synchronize time on your devices with NTP service or just set tick 2 checkboxes in Settings in your device: Automatic date & time and Automatic time zone

Hope this help

Rubycon
  • 18,156
  • 10
  • 49
  • 70
  • 1
    I had set tick 2 checkboxes, still getting the error. – Kamalakannan J Jul 29 '15 at 17:45
  • On some devices, notably the Samsung Tab 4, there is not an option in the Android settings for Automatic Time Zone. (Obviously a flaw in Samsung's ROM). In this unfortunate case, how can we deal with the bad timestamp error when the time isn't synchronized? – Michael DePhillips Jan 11 '16 at 16:09
-1

Please check the official manual (page 89) where the time settings are described

manual

Stas
  • 112
  • 2
  • Instructing the user to look at their specific device manual does not seem to be a proper solution. There would be no way to link it from within the application. – Michael DePhillips Feb 03 '16 at 16:06