package com.hanseo_software.gpstrackerapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.SignInMethodQueryResult;
import java.util.List;
public class RegisterActivity extends AppCompatActivity {
EditText e4_email;
FirebaseAuth auth;
ProgressDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
e4_email = (EditText)findViewById(R.id.editText4);
auth = FirebaseAuth.getInstance();
dialog = new ProgressDialog(this);
}
// public void goToPasswordActivtity(View v) {
// Intent myIntent = new Intent(RegisterActivity.this, PasswordActivity.class);
// startActivity(myIntent);
// }
public void goToPasswordActivtity(View v) {
dialog.setMessage("checking email address");
dialog.show();
//이 이메일이 실제로 있는지 없는지 확인
auth.fetchSignInMethodsForEmail(e4_email.getText().toString())
.addOnCompleteListener(new OnCompleteListener<SignInMethodQueryResult>() {
@Override
public void onComplete(@NonNull Task<SignInMethodQueryResult> task) {
if (task.isSuccessful()) {
dialog.dismiss();
//boolean check = !task.getResult().getProviders().isEmpthy();
boolean check = !task.getResult().getSignInMethods().isEmpty();
if (!check) {
//if (task.getResult().getSignInMethods().size() == 0){
//email이 존재하지 않아서 생성할 수 있다.
Intent myIntent = new Intent(RegisterActivity.this, PasswordActivity.class);
myIntent.putExtra("eamil", e4_email.getText().toString());
startActivity(myIntent);
finish();
} else {
dialog.dismiss();
Toast.makeText(getApplicationContext(),"이 eamail은 이미 생성되어 있습니다.",Toast.LENGTH_LONG).show();
}
}
}
});
}
}
이메일을 입력하고 next를 누르면 강제종료가 발생합니다. 수정 전에는 다른 부분에서 강제종료가 발생했는데 수정 후에는 이 부분에서 강제 종료가 발생합니다.
<manifest xmlns:android="
http://schemas.android.com/apk/res/android"
package="com.hanseo_software.gpstrackerapp">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".UserLocationMainActivity"
android:label="@string/title_activity_user_location_main"
android:theme="@style/AppTheme.NoActionBar"></activity>
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat" />
<activity android:name=".InviteCodeActivity" />
<activity android:name=".NameActivity" />
<activity android:name=".PasswordActivity" />
<activity android:name=".RegisterActivity" />
<activity android:name=".LoginActivity" />
</application>
</manifest>