Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adsense Quickstart App crashing on start #4

Open
positivelymade opened this issue Jul 20, 2015 · 1 comment
Open

Adsense Quickstart App crashing on start #4

positivelymade opened this issue Jul 20, 2015 · 1 comment

Comments

@positivelymade
Copy link

Solved the error that occurred when the app starts. App starts, then onCreate is called, then onNavigationItemSelected(..) is called, then refreshView() is called because at this point publisherAccountId is null, which then calls apiController.loadAccounts() which has an invalid credential name because no account name was ever set.

The app was trying to loadaccounts from null user.

Change in MainActivity:

  • if ((apiController.getAccounts() == null) || (publisherAccountId == null)) {
  •  status = AppStatus.GETTING_ACCOUNT_ID;
    
  •  refreshView();
    
  •  return true;
    

To:

  • if ((apiController.getAccounts() == null) && (publisherAccountId == null)) {
  •    chooseDeviceAccount();
    
  •    return true;
    
  • } else if ((apiController.getAccounts() == null) || (publisherAccountId == null)) {
  •    status = AppStatus.GETTING_ACCOUNT_ID;
    
  •    refreshView();
    
  •    return true;
    
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@positivelymade and others