App crashes on email request

android

#1

Hi

My twitter app is whitelisted too make request from users. I have added the code but the app crashes after the integration.

Below is the snippet:-

loginButton = (TwitterLoginButton) findViewById(R.id.twitter_login_button);
		//loginButton.setBackgroundResource(R.drawable.twitter_login); 
		loginButton.setText("connect with twitter");
		loginButton.setTypeface(tfBold);
        loginButton.setCallback(new Callback<TwitterSession>() {
            @SuppressWarnings("unchecked")
			@Override
            public void success(Result<TwitterSession> result) {
                // Do something with result, which provides a TwitterSession for making API calls
            	Toast.makeText(LoginActivity.this, result.data.getUserId()+" Login Successfull: "+result.data.getUserName(), Toast.LENGTH_SHORT).show();
            	
//            	 new CreateUser(result.data.getUserName(), result.data.getUserName()+"@twitter.com",
//            			 result.data.getUserId()+"", "TWITTER").execute(); //send async request to create users
            	TwitterAuthClient authClient = new TwitterAuthClient();
            	authClient.requestEmail(result.data, new Callback() {
            	    @Override
            	    public void success(Result result) {
            	        // Do something with the result, which provides
            	        // the email address
//            	    	
//            	    	com.twitter.sdk.android.core.models.User user = Twitter.getApiClient().getAccountService().verifyCredentials(true, false);
//            	    	
//            	    	Toast.makeText(LoginActivity.this, user.name+" : " + user.email+":  " + user.profileImageUrl,
//            	    			Toast.LENGTH_LONG).show();
            	    }
            	 
            	    @Override
            	    public void failure(TwitterException exception) {
            	      // Do something on failure
            	    	com.twitter.sdk.android.core.models.User user = Twitter.getApiClient().getAccountService().verifyCredentials(true, false);
            	    	Toast.makeText(LoginActivity.this, user.name+" : Email Cancelled " + user.email+":  " + user.profileImageUrl,
            	    			Toast.LENGTH_LONG).show();
            	    }
            	});
//            	
            	 t.send(new HitBuilders.EventBuilder()
	  		       .setCategory("LoginActivity")
	  		       .setAction("TwitterLogin")
	  		       .setLabel("success")
	  		       .build());
            }

            @Override
            public void failure(TwitterException exception) {
                // Do something on failure
            	Toast.makeText(LoginActivity.this, "Login Unsuccessfull", Toast.LENGTH_SHORT).show();
            	t.send(new HitBuilders.EventBuilder()
	  		       .setCategory("LoginActivity")
	  		       .setAction("TwitterLogin")
	  		       .setLabel("failed")
	  		       .build());
            }
        });

The crash happens after the user accepts the request for email. Theres no log report telling about the details of crash.

Tks


#2

Hi Invincible1388,
How did you got your app whitelisted to get email address? Under which one do we need to request to whitelist the app in here? (https://support.twitter.com/forms/platform)


#3