Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback not being invoked #12

Open
pradyumnad opened this issue Mar 1, 2016 · 14 comments
Open

Callback not being invoked #12

pradyumnad opened this issue Mar 1, 2016 · 14 comments

Comments

@pradyumnad
Copy link

There are no debug logs and the ProgressDialog is not being dismissed.

BackgroundMail.newBuilder(this)
                .withUsername("myemail@gmail.com")
                .withPassword("mypassword")
                .withMailto("toemail@mail.umkc.edu")
                .withSubject("this is the subject")
                .withBody(body)
                .withOnSuccessCallback(new BackgroundMail.OnSuccessCallback() {
                    @Override
                    public void onSuccess() {
                        Log.d("BackgroundMail", "Success");
                        //do some magic
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                mProgressDialog.dismiss();
                            }
                        });
                    }
                })
                .withOnFailCallback(new BackgroundMail.OnFailCallback() {
                    @Override
                    public void onFail() {
                        Log.d("BackgroundMail", "Failed");
                        //do some magic
                        mProgressDialog.dismiss();
                    }
                })
                .send();
@miikorz
Copy link

miikorz commented Mar 28, 2016

Same issue, did you get any solution?

@Leepee
Copy link

Leepee commented Apr 8, 2016

I have the same issue :( Any code I put into the callbacks never works. I need to supply an error to the user if it didn't work. Thanks for the library by the way. Awesome :)

@zosocanuck
Copy link

I am also encountering the same issue. No callbacks are being issued.

@dharmagetic
Copy link

dharmagetic commented May 18, 2016

I am also encoutering the same isse. But I found solution. Simple add this line '.withProcessVisibility(true)'

@waseem-wurfel
Copy link

when you add .withProcessVisibility(true) the library will not send email

@paritosh-engg01
Copy link

BackgroundMail.newBuilder(this)
.withUsername("myemail@gmail.com")
.withPassword("mypassword")
.withMailto("toemail@mail.umkc.edu")
.withSubject("this is the subject")
.withBody(body)
.withOnSuccessCallback(new BackgroundMail.OnSuccessCallback() {
@OverRide
public void onSuccess() {
Log.d("BackgroundMail", "Success");
//do some magic
runOnUiThread(new Runnable() {
@OverRide
public void run() {
mProgressDialog.dismiss();
}
});
}
})
.withOnFailCallback(new BackgroundMail.OnFailCallback() {
@OverRide
public void onFail() {
Log.d("BackgroundMail", "Failed");
//do some magic
mProgressDialog.dismiss();
}
})
.withProcessVisibility(true)
.send();

add like this

@lectricas
Copy link

any progress with this issue?

@lectricas
Copy link

.withProcessVisibility(true) solved the issue!

@yhercouet
Copy link

.withProcessVisibility(true) does not change anything, that just displays message when sending the email, it does not activate the callbacks.

@tharoldD
Copy link

Solved it by implementing the callbacks in the activity.

@Leepee
Copy link

Leepee commented Mar 3, 2017

Can confirm that the callbacks do work if you use .withProcessVisibility(true). I'm guessing something in that method enables them? Be nice if this could be implemented as a fix because this lib is great, but I'm not sure it is being updated anymore.

@luongvo
Copy link
Contributor

luongvo commented Mar 16, 2017

This PR #35 may resolve this issue

@androidovshchik
Copy link

androidovshchik commented Feb 9, 2018

Surely?

@Override
protected void onPostExecute(Boolean result) {
 super.onPostExecute(result);
 if (processVisibility) {
  progressDialog.dismiss();
  if (result) {
   if (!TextUtils.isEmpty(sendingMessageSuccess)) {
    Toast.makeText(mContext, sendingMessageSuccess, Toast.LENGTH_SHORT).show();
   }
   if (onSuccessCallback != null) {
    onSuccessCallback.onSuccess();
   }
  } else {
   if (!TextUtils.isEmpty(sendingMessageError)) {
    Toast.makeText(mContext, sendingMessageError, Toast.LENGTH_SHORT).show();
   }
   if (onFailCallback != null) {
    onFailCallback.onFail();
   }
  }
 }
}

Is this fixed? I don't think the same
My fix is to override library asynctask by removing if (processVisibility) { condition with dialog
What is the real purpose of the last? I think it is not difficult to write custom ui

@luongvo
Copy link
Contributor

luongvo commented Feb 9, 2018

@androidovshchik The author did not merge my PR, it's still a waiting for merging PR, please check my forked lib instead: https://github.com/luongvo/GmailBackground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests