Votter Archives - GlobeOtter

# Category Archives: Votter

# Disqus Login and Logout in Android

Posted on January 16, 2014 by ndgreen

Disqus login and logout features as described in the previous blog entry on Disqus (http://globeotter.com/blog/disqus-android-code/) do not work as intended in the latest updates. Currently if you followed the Code the login will stay busy and the page has to be refreshed. You can see the busy signal in the screenshot below. To get rid of it you have to change Activities and come back to the Disqus page (in which you are auto logged in). After looking into it a bit, we found a nice work around for these issues.

If you would like to see how the code works you can look at our new App we made to Demo the functionality, The Daily Forum https://play.google.com/store/apps/details?id=otter.forum

The solution to the Disqus login and logout issues are contained in the WebViewClient in Android. It is not picking up the redirect and refreshing the page in the javascript. To address this we will need a new class that extends WebViewClient

## MyWebViewClient.java

    public class MyWebViewClient extends WebViewClient {

    private String myUrl;
     public MyWebViewClient(String _myURL) {
     // TODO Auto-generated constructor stub
     myUrl=_myURL;

     }
     @Override
     public void onPageStarted(WebView view, String url, Bitmap favicon) {
     Log.i("page started", url);
     }

    @Override
     public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
     Log.i("disqus error", "failed: " + failingUrl + ", error code: " + errorCode + " [" + description + "]");
     }

    public void onPageFinished(WebView view, String url) {
     if(url.indexOf("logout")>-1 || url.indexOf("disqus.com/next/login-success")>-1 ){
     view.loadUrl(myUrl);

     }
     if(url.indexOf("disqus.com/_ax/twitter/complete")>-1||url.indexOf("disqus.com/_ax/facebook/complete")>-1||url.indexOf("disqus.com/_ax/google/complete")>-1){
     view.loadUrl("YOUR_URL/login.php");

     }
     if(url.indexOf("YOUR_URL/login.php")>-1){
     view.loadUrl(myUrl);
    }
    }
    }

There are a few key features of this code. First it is listening for the Twitter,Facebook, and Google Plus login code. Your WebViewClient will now be looking for this URL “disqus.com/_ax”. When it detects this we send it to a blank URL login.php. This login page does nothing, we only use it so we can detect that the 3rd party login was successful. Second, after we have either detected a 3rd party login (via login.php) or have been logged in via disqus (“disqus.com/next/login-success”) we refresh our URL (this is the URL passed in that your disqus page was using). Third, the logout code is quite simple. When a logout is detected simply refresh the url as well.

Next we need to actually call this class. We will use the same Disqus.java class as the previous blog entry on Disqus, but this time we will call MyWebViewClient

## Disqus.java

    </pre>
    public abstract class Disqus extends Activity
    {
    private WebView webDisqus;

    protected void onCreate(Bundle savedInstanceState)
    {

    //set layout to disqus xml
    String url="http:///showcomments.php?disqus_id="+insert disqus thread is here;
    setContentView (R.layout.disqus);

    webDisqus = (WebView) findViewById(R.id.disqus);
     //set up disqus
     WebSettings webSettings2 = webDisqus.getSettings();

    webSettings2.setJavaScriptEnabled(true);

    webSettings2.setBuiltInZoomControls(true);

    webDisqus.requestFocusFromTouch();

    //set to the new WebViewClient Class
    webDisqus.setWebViewClient(new MyWebViewClient(url));

    webDisqus.setWebChromeClient(new WebChromeClient());

    webDisqus.loadUrl(url);

    }

    }

We hope this helps if you were struggling with the Disqus login and logout in Android. Let us know if it works for you. If you get a chance check out the Daily Forum and leave us a review!

# Social Voting Platform, Votter, has a Quarter Million Votes in March

Posted on April 10, 2013 by ndgreen

Things have been very busy with the Votter Team in March. We reach a milestone, having a quarter million votes cast in a single month. With the new growth came many new poll types. To better handle and categorize all your polls we added a Fashion, Foodie, Am I pretty, Pets and Animals, Follow Me, and Fitness categories. By far the most popular have been the “Am I Pretty?” and the “Fashion” Categories.

Our two most popular polls were a combination of social awareness and fashion! This Poll about smoking started one of our largest Disqus debates as of yet!

With Prom season coming up we are seeing many Fashion polls like the second and they remain popular. The dress poll was the second most popular poll of the month.

If you have an event coming up head on over to the Android app and submit a poll today.

# Votter Release: Now with Image Polls and Two New Categories

Posted on February 5, 2013 by ndgreen

A little update about the new Votter release that allows Image Polls. With this update you can include a photo with your poll options. With the image polls feature we have also opened up two new categories. First, we are calling “Where in the world?”. For this upload a photo of your location and give us a few options to guess what country you are in. When the poll closes remember to come back and tell us the correct answer in the Disqus comments section. The second new category will be “fashion”. We have already had submission for photos of outfits and whether or not to wear them. We think these two categories will be a fun diversion from some of the political topics which have been popular recently. We hope you enjoy the new categories.

With images comes some additional functionality. We have upgraded our “mature” filtering options so that it covers all functionality in the App. If you would like “mature” polls turned off please use the android options panel to toggle this option. All polls are subject to approval so with this off you should only see more “family friendly” polls to vote on.

Image of the new Where in the World Image Polls on Votter

Other than this feature we have fixed a few lingering bugs that had the program acting in ways not intended. Remember to check your language options to make sure you are receiving polls in other languages if you want them. We hope you like the new image polls and category types and look forward to seeing the image polls you submit in the two new categories.

Enjoy and get Vottering,

The Votter Team

# Votter Release : DISQUS comment system

Posted on December 25, 2012 by ndgreen

Some may have noticed that both for this blog and thevotter.com we use the DISQUS comment system. We had originally started out with our own “Blotter” commenting system but it quickly became alot to monitor without all the features we would want. We had been users of the DISQUS comment system on other sites such as CNN so we figured we’d give it a shot. The web setup took about 10 minutes and implementation took only about an hour to modify our php files to use their API. Not bad at all but it did leave use with two disjoint systems since our Android app still used our old Blotter system.

With this update the blotter system has been removed and DISQUS has been implemented within our Android App. Now the comments will sync between the web and the app. We hope everyone enjoys the new system as they can have same account for commenting across news sites and across apps. You can give the comment system a try right here in the blog by registering with any of the social networks. If you like it, please let us know.

For those who didn’t update in version 1.06, we now also have Facebook Login for android. This is using the newly released facebook android SDK last week. We hope this will reduce the amount of users who download the app but don’t register. Using this plugin users can login to our App without registering. The Android code for this is a bit more complex than DISQUS. Hopefully when the SDK is out a bit longer some standard approaches will be available. However, if readers are interested we can release our code for the login script.

When looking at the Google App store we only saw a handful of apps using the DISQUS comment system so we may do a code segment in a few days to help those who want to implement a similar system in Android. Let us know in the comment section if you need the code or just the general approach.

If you haven’t downloaded Votter you can follow the Google Play link below

Search

# Recent Posts

- Disqus Login and Logout in Android
- Android Advertising Options
- Social Voting Platform, Votter, has a Quarter Million Votes in March
- Votter Release: Now with Image Polls and Two New Categories
- Tracking Apps Across Countries

# Recent Comments

- Ulvis on DISQUS on Android
- Victor Eric on DISQUS on Android
- Maegan M Cook on DISQUS on Android
- kgbme on DISQUS on Android
- Aaradhya Mishra on DISQUS on Android

# Archives

- January 2014
- December 2013
- April 2013
- February 2013
- January 2013
- December 2012

# Categories

- Code Sample
- Daily Forum
- DISQUS
- GlobeOtter
- Google Play
- Indonesia Road Signs
- Uncategorized
- USA Road Sign Test
- Votter

# Meta

- Register
- Log in
- Entries feed
- Comments feed
- WordPress.org

# Meta

- Register
- Log in

# Archives

- January 2014
- December 2013
- April 2013
- February 2013
- January 2013
- December 2012