Example usage for android.provider VoicemailContract ACTION_FETCH_VOICEMAIL

List of usage examples for android.provider VoicemailContract ACTION_FETCH_VOICEMAIL

Introduction

In this page you can find the example usage for android.provider VoicemailContract ACTION_FETCH_VOICEMAIL.

Prototype

String ACTION_FETCH_VOICEMAIL

To view the source code for android.provider VoicemailContract ACTION_FETCH_VOICEMAIL.

Click Source Link

Document

Broadcast intent to request a voicemail source to fetch voicemail content of a specific voicemail from the remote server.

Usage

From source file:com.android.dialer.voicemail.VoicemailPlaybackPresenter.java

/**
 * Makes a broadcast request to ask that a voicemail source fetch this content.
 * <p>/*  ww  w .j a v a 2 s .c  om*/
 * This method <b>must be called on the ui thread</b>.
 * <p>
 * This method will be called when we realise that we don't have content for this voicemail. It
 * will trigger a broadcast to request that the content be downloaded. It will add a listener to
 * the content resolver so that it will be notified when the has_content field changes. It will
 * also set a timer. If the has_content field changes to true within the allowed time, we will
 * proceed to {@link #prepareContent()}. If the has_content field does not
 * become true within the allowed time, we will update the ui to reflect the fact that content
 * was not available.
 *
 * @return whether issued request to fetch content
 */
protected boolean requestContent(int code) {
    if (mContext == null || mVoicemailUri == null) {
        return false;
    }

    FetchResultHandler tempFetchResultHandler = new FetchResultHandler(new Handler(), mVoicemailUri, code);

    switch (code) {
    case ARCHIVE_REQUEST:
        mArchiveResultHandlers.add(tempFetchResultHandler);
        break;
    default:
        if (mFetchResultHandler != null) {
            mFetchResultHandler.destroy();
        }
        mView.setIsFetchingContent();
        mFetchResultHandler = tempFetchResultHandler;
        break;
    }

    // Send voicemail fetch request.
    Intent intent = new Intent(VoicemailContract.ACTION_FETCH_VOICEMAIL, mVoicemailUri);
    mContext.sendBroadcast(intent);
    return true;
}