Android应用程序

时间:2017-12-11 09:39:28

标签: java android

我正在尝试调试Android应用程序。在注册过程中,我只需要一个电话号码。我的源代码如下所示:

private void handleRegistrationIntent(Intent intent) {
    markAsVerifying(true);
    Log.w("RegistrationService","State change to handleRegistrationIntent");

    AccountCreationSocket socket = null;
    String number                = intent.getStringExtra("e164number");

try {
    String password = Util.getSecret(18);
    String key      = Util.getSecret(40);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    Editor editor                 = preferences.edit();
    editor.putString(Constants.PASSWORD_PREFERENCE, password);
    editor.putString(Constants.KEY_PREFERENCE, key);
    editor.commit();

    initializeChallengeListener();

    setState(new RegistrationState(RegistrationState.STATE_CONNECTING, number));
    Log.w("RegistrationService", "State change to STATE_CONNECTING");
    System.out.println(number);
    socket = new AccountCreationSocket(this, number, password);
    socket.createAccount(false);
    socket.close();

    setState(new RegistrationState(RegistrationState.STATE_VERIFYING_SMS, number));
    Log.w("RegistrationService", "State change to STATE_VERIFYING_SMS");
    String challenge = waitForChallenge();
    socket           = new AccountCreationSocket(this, number, password);
    socket.verifyAccount(challenge, key);

在Logcat Android中,我得到了这个日志:

  

12-11 10:49:12.561 7769-7769 / com.qepon W / RegistrationProgress:状态更改为handleStateIdle

     

12-11 10:49:12.611 7769-7769 / com.apps I / Timeline:Timeline:Activity_idle id:android.os.BinderProxy@1a8792e8 time:10508674

     

12-11 10:49:12.611 7769-8779 / com.apps W / RegistrationService:状态更改为handleRegistrationIntent

     

12-11 10:49:12.651 7769-8779 / com.apps W / RegistrationService:状态更改为STATE_CONNECTING

     

12-11 10:49:12.651 7769-8779 / com.apps I / System.out: + 62898xxxxxxx

结束了。在GUI中,我收到一个错误:无法连接到网络,但我可以使用我的智能手机浏览。除此之外,我没有在服务器中收到错误或错误。 我很困惑这个应用程序的问题是什么。有人可以帮我吗?谢谢

1 个答案:

答案 0 :(得分:0)

您是否已使用androidManifest.xmlandroid.pemission.INTERNET文件中设置应用程序访问互联网的权限?