Android LoginButton - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android LoginButton class.

This code example shows how to use the following methods:performClick, setDefaultAudience, setPublishPermissions, setSession
                new SessionTestsBase.SessionStatusCallbackRecorder(); 
 
        // Verify state with no token in cache 
        assertEquals(SessionState.CREATED, session.getState());
 
        final LoginButton button = new LoginButton(getActivity());
        button.setSession(session);
        button.setPublishPermissions(Arrays.asList(new String[] {"publish_permission", "publish_another"}));
        button.setDefaultAudience(SessionDefaultAudience.FRIENDS);
        session.addAuthorizeResult("A token of thanks", new ArrayList<String>(), AccessTokenSource.TEST_USER);
        session.addCallback(statusRecorder);
 
        button.performClick();
 
        statusRecorder.waitForCall(session, SessionState.OPENING, null);
        statusRecorder.waitForCall(session, SessionState.OPENED, null);
 
        assertNotNull(session.getLastRequest());
        assertEquals(SessionDefaultAudience.FRIENDS, session.getLastRequestAudience());
 
5
CodeRank

Related Android LoginButton Questions & Answers:

See Code Examples for Android LoginButton Methods: