QuickBlox / q-municate-android

Qmunicate Android chat application
MIT License
254 stars 197 forks source link

can't signup #222

Closed iman2420 closed 1 year ago

iman2420 commented 7 years ago

startSignUpActivity not used in this link. And SignUpButton not found AND when resultAction=signup_action , command is NULL

        ` if (intent != null && (action = intent.getAction()) != null) {
        Log.d(TAG, "service started with resultAction=" + action);
        ServiceCommand command = serviceCommandMap.get(action);
        if (command != null) {
            startAsync(command, intent);
        }else {
            Log.d(TAG, "startAsync command is NULL");
        }
    }`
RomanPronin commented 7 years ago

@iman2420, yes, that's right! Now SignUpActivity is not used. You can sign up with phone number via twitterDigits. SignUpActivity is a sketch. If you want to use SignUpActivity in your project, you should make signUp logic by your own.

iman2420 commented 7 years ago

@RomanPronin I use this code to signUp in background:

        `  public void signUpFromMainActivity() {
    final QBUser user = new QBUser(App.MY_UNIQUE_ID, App.MY_UNIQUE_ID);
    user.setWebsite(App.MY_UNIQUE_ID);
    if (App.MY_EMAIL != null)
        if (!App.MY_EMAIL.equals(""))
            user.setEmail(App.MY_EMAIL);
    user.setFullName(App.MY_NICK_NAME);
    user.setPhone(App.MY_PHONE);
    StringifyArrayList<String> tags = new StringifyArrayList<>();
    tags.add(App.MY_SEX);
    tags.add("iman2420tag");
    // tags.add(App.MY_UNIQUE_ID);
    user.setTags(tags);
    QBUsers.signUpSignInTask(user).performAsync(new QBEntityCallback<QBUser>() {
        @Override
        public void onSuccess(QBUser qbUser, Bundle bundle) {
            Log.e(TAG, "signUpFromMainActivity onSuccess " + qbUser.getLogin());
            startMainActivity(qbUser);
        }

        @Override
        public void onError(QBResponseException error) {
            Log.e(TAG, "signUpFromMainActivity onError " + error.getMessage());

        }
    });
     }`

But i got this error in Body:

BODY '{"errors":{"base":["Forbidden. Need user."]}}'

iman2420 commented 7 years ago

I need to signup by user/password . how to do it ?

RomanPronin commented 7 years ago

@iman2420, in which request do you receive this response? Show us log with request and response.

iman2420 commented 7 years ago

@RomanPronin .I have already registered users in elsewhere. With this method:

   `public void signUp() {
    progressDialog.show();
    final QBUser user = new QBUser(App.MY_UNIQUE_ID, App.MY_UNIQUE_ID);//Like 5752f5c215c8f5.60807023
    user.setWebsite(App.MY_UNIQUE_ID);
    if (App.MY_EMAIL != null)
        if (!App.MY_EMAIL.equals(""))
            user.setEmail(App.MY_EMAIL);
    user.setFullName(App.MY_NICK_NAME);
    user.setPhone(App.MY_PHONE);
    StringifyArrayList<String> tags = new StringifyArrayList<String>();
    tags.add(App.MY_SEX);
    tags.add("iman2420tag");
    // tags.add(App.MY_UNIQUE_ID);
    user.setTags(tags);
    QBUsers.signUpSignInTask(user).performAsync(new QBEntityCallback<QBUser>() {
        @Override
        public void onSuccess(QBUser qbUser, Bundle bundle) {
            Log.e(TAG, "signUp onSuccess "+ qbUser.getLogin());
            progressDialog.dismiss();
            proceedToTheNextActivity();
        }
        @Override
        public void onError(QBResponseException error) {
            Log.e(TAG, "signUp onError "+ error.getMessage());
            progressDialog.dismiss();
            View rootLayout = findViewById(R.id.layout_root);
            showSnackbarError(rootLayout, R.string.login_title, error, new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    createSession();
                    signUp();
                }
            });
            if (error.getMessage() != null && error.getMessage().equals("Unauthorized")) {
            }
        }
    });
}`

Now i want to login and redirect user to MainActivity with out going to LandingActivity. how to do it?