PokeGOAPI-Java icon indicating copy to clipboard operation
PokeGOAPI-Java copied to clipboard

anybody give me a hand plaese..

Open n3wdev opened this issue 10 years ago • 4 comments

I can login to PokemonGO without asynctask in Eclipse But in Android Studio i did it in asynctask but my app alway crash can someone give me an example code to login with Android Studio please.. Thank you

n3wdev avatar Sep 01 '16 17:09 n3wdev

provide stacktrace please

FabianTerhorst avatar Sep 01 '16 17:09 FabianTerhorst

this is my simple code to test, but it's not work like i said. what i missed?

`public class MainActivity extends AppCompatActivity { OkHttpClient httpClient = new OkHttpClient(); PokemonGo go = new PokemonGo(httpClient); PlayerProfile profile; TextView text1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text1=(TextView)findViewById(R.id.text1); new login().execute();

}

private class login extends AsyncTask<Void, Integer, String>  {
    protected void onPreExecute()  {

    }

    protected String doInBackground(Void... params)    {
        try {
            go.login(new PtcCredentialProvider(httpClient, "tsitpogo", "tsitpogo"));
            profile = go.getPlayerProfile();
        } catch (LoginFailedException e) {
            e.printStackTrace();
        } catch (RemoteServerException e) {
            e.printStackTrace();
        }
        String user = profile.getPlayerData().getUsername();
        return user;
    }


    protected void onPostExecute(String result)  {
        Toast.makeText(MainActivity.this,result,Toast.LENGTH_LONG).show();
    }
}`

n3wdev avatar Sep 01 '16 17:09 n3wdev

Nobody can help you with out the stack trace.

Gegy avatar Sep 01 '16 18:09 Gegy

these isn't error or exception, app just crash image

n3wdev avatar Sep 02 '16 05:09 n3wdev