android - Firebase email authentication? -
i'm trying use firebase (email authentication) android app. don't recieve error msg., doesn't work. i'm stuck somewhere , cant solve. need help. thanks.
- package name same (firebase , app).
- i imported json file in project app folder.
- sign-in method = email/password = enabled
database rule published:
{ "rules": { ".read": true, ".write": true, } }
this build.gradle :
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' } } allprojects { repositories { jcenter() } }
this build.gradle (app):
apply plugin: 'com.android.application' android { compilesdkversion 24 buildtoolsversion "24.0.1" defaultconfig { applicationid "com.mypack.kim" minsdkversion 16 targetsdkversion 22 } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } packagingoptions { exclude 'meta-inf/license' exclude 'meta-inf/license-firebase.txt' exclude 'meta-inf/notice' } } dependencies { compile 'com.android.support:support-v4:24.1.1' compile 'com.firebase:firebase-client-android:2.5.2' }
login class :
package com.mypack.kim; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.edittext; import com.firebase.client.authdata; import com.firebase.client.firebase; import com.firebase.client.firebaseerror; import com.mypack.ream.r; public class loginme extends activity { button btlog; edittext eduser,edpass; public static firebase firejo; string email,pass; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.login_pg); btlog = (button) findviewbyid(r.id.btlog); eduser = (edittext) findviewbyid(r.id.eduser); edpass = (edittext) findviewbyid(r.id.edpass); firebase.setandroidcontext(this); firejo = new firebase("https://try-ad555.firebaseio.com/"); btlog.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { email = eduser.gettext().tostring(); pass = edpass.gettext().tostring(); login(email, pass); } }); } public void login(final string email, string pass) { firetunc.authwithpassword(email, pass, new firebase.authresulthandler() { @override public void onauthenticated(authdata authdata) { intent istat = new intent(loginme.this, main_page.class); startactivity(istat); } @override public void onauthenticationerror(firebaseerror firebaseerror) { } }); } }
Comments
Post a Comment