当前位置: 首页>>代码示例>>Java>>正文


Java Firebase.authWithCustomToken方法代码示例

本文整理汇总了Java中com.firebase.client.Firebase.authWithCustomToken方法的典型用法代码示例。如果您正苦于以下问题:Java Firebase.authWithCustomToken方法的具体用法?Java Firebase.authWithCustomToken怎么用?Java Firebase.authWithCustomToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.firebase.client.Firebase的用法示例。


在下文中一共展示了Firebase.authWithCustomToken方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_weekly, container, false);
    AnalyticsApplication application = (AnalyticsApplication) getActivity().getApplication();
    mTracker = application.getDefaultTracker();
    Firebase.setAndroidContext(getActivity());
    mRootRef = new Firebase("https://guessthehashtag.firebaseio.com/data");
    mRootRef.authWithCustomToken("91cvapZgSdVcjyvrepGKS2nSgDDFAiiDBLDl97Rx", new Firebase.AuthResultHandler() {
        @Override
        public void onAuthenticated(AuthData authData) {

        }

        @Override
        public void onAuthenticationError(FirebaseError firebaseError) {

        }
    });
    mUsersDataset = new ArrayList<>();
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.week_recycler_view);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setHasFixedSize(true);
    RecyclerView.ItemDecoration itemDecoration = new
            DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST);
    mRecyclerView.addItemDecoration(itemDecoration);
    mLoadingWrapper = (RelativeLayout) rootView.findViewById(R.id.week_loading_wrapper);
    renderData();
    return rootView;
}
 
开发者ID:silva96,项目名称:guessthehashtag,代码行数:32,代码来源:WeeklyFragment.java

示例2: onCreate

import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    // Obtain the shared Tracker instance.
    AnalyticsApplication application = (AnalyticsApplication) getApplication();
    mTracker = application.getDefaultTracker();
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);
    Firebase.setAndroidContext(getApplicationContext());
    mRootRef = new Firebase("https://guessthehashtag.firebaseio.com/data");
    mRootRef.authWithCustomToken("91cvapZgSdVcjyvrepGKS2nSgDDFAiiDBLDl97Rx", new Firebase.AuthResultHandler() {
        @Override
        public void onAuthenticated(AuthData authData) {

        }

        @Override
        public void onAuthenticationError(FirebaseError firebaseError) {

        }
    });
    mButton1 = (Button) findViewById(R.id.hashtag1);
    mButton2 = (Button) findViewById(R.id.hashtag2);
    mButton3 = (Button) findViewById(R.id.hashtag3);
    mButton4 = (Button) findViewById(R.id.hashtag4);
    //Call<SearchData> call = Helper.service().listImages("-33.4456328","-70.6157308", Helper.getToken(this));
    mInstaImage = (ImageView) findViewById(R.id.insta_image);
    mContentWrapper = (ScrollView) findViewById(R.id.content_wrapper);
    mLoaderWrapper = (RelativeLayout) findViewById(R.id.loading_wrapper);
    mScoreText = (TextView) findViewById(R.id.score_text);
    mStreakText = (TextView) findViewById(R.id.streak_text);
    mScoreText.setText("--");
    mStreakText.setText("" + Helper.mCurrentStreak);
    mResultsButton = (ImageView) findViewById(R.id.results_img);
    mResultsButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            goToResults();
        }
    });
    getUser();
    checkThings();


}
 
开发者ID:silva96,项目名称:guessthehashtag,代码行数:47,代码来源:MainActivity.java

示例3: createFirebaseReference

import com.firebase.client.Firebase; //导入方法依赖的package包/类
/**
 * Creates all firebase references for the current session.
 *
 * @param model
 * @param deviceName
 * @param uniqueID
 * @param demo
 * @param sensor
 * @return
 */
public String createFirebaseReference(String model, String deviceName, String uniqueID, String demo, ThunderBoardSensor sensor) {

    try {

        long currentTime = System.currentTimeMillis();

        String rootDataThundeBoardSessionsUrl = String.format("%s%s/sessions", baseDataThunderBoardUrl, model);
        Timber.d("rootDataThundeBoardSessionsUrl: %s", rootDataThundeBoardSessionsUrl);
        rootDataThundeBoardSessionsReference = new Firebase(rootDataThundeBoardSessionsUrl);
        rootDataThundeBoardSessionsReference.authWithCustomToken(keyFirebase, this);

        String rootDataSessionsUrl = String.format("%s%s", baseDataSessionsUrl, uniqueID);
        Timber.d("rootDataSessionsUrl: %s", rootDataSessionsUrl);
        rootDataSessionsReference = new Firebase(rootDataSessionsUrl);
        rootDataSessionsReference.authWithCustomToken(keyFirebase, this);
        rootDataSessionsDemoReference = rootDataSessionsReference.child(demo);

        // push the start time
        rootDataSessionsReference.child(START_TIME).setValue(currentTime);
        rootDataSessionsReference.child(TEMPERATURE_TYPE).setValue(prefsManager.getPreferences().temperatureType);
        rootDataSessionsReference.child(MEASUREMENTS_TYPE).setValue(prefsManager.getPreferences().measureUnitType);
        Timber.d("root sessions ref: %s", rootDataSessionsReference.getPath().toString());

        // push contactInfo
        ContactInfo ci = new ContactInfo();
        ThunderBoardPreferences prefs = prefsManager.getPreferences();
        ci.emailAddress = prefs.userEmail;
        ci.fullName = prefs.userName;
        ci.title = prefs.userTitle;
        ci.phoneNumber = prefs.userPhone;
        ci.deviceName = deviceName;
        rootDataSessionsReference.child("contactInfo").setValue(ci);

        String demoUrl = String.format("%s%s/%s/%s", baseDemoSessionsUrl, model, uniqueID, demo);
        Timber.d("short demo url: %s", demoUrl);
        rootDataSessionsReference.child(SHORT_URL).setValue(demoUrl);
        // will be overriden later, we do not want to keep it null....
        // if the requirement is to use a short url, then a refactor is needed to wait until it's available
        shortUrl = demoUrl;

        data = new HashMap<>();

        push(sensor);

        pushTimer.start();

        // request in the background
        shortenUrlReference = rootDataSessionsReference;
        shortenUrl(demoUrl);

        rootDataThundeBoardSessionsReference.child(String.valueOf(currentTime)).setValue(uniqueID);

        return demoUrl;

    } catch (FirebaseException e) {
        e.printStackTrace();
        Timber.d(e.getMessage());
        return null;
    }
}
 
开发者ID:SiliconLabs,项目名称:thunderboard-android,代码行数:71,代码来源:CloudManager.java


注:本文中的com.firebase.client.Firebase.authWithCustomToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。