App hibrido, mas sem uso de javascript
LoadProgress = new ProgressDialog(this);
LoadProgress.setMessage("wait a moment...");
LoadProgress.show();
webView.setWebViewClient(new WebViewClient() {
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed() ;
}
});
AESCrypt mcrypt = new AESCrypt();
try {
myemailcrypt = AESCrypt.bytesToHex( mcrypt.encrypt(myemail) );
mypasswordcrypt = AESCrypt.bytesToHex( mcrypt.encrypt(mypassword) );
} catch (Exception e) {
}
String postData = "login=" + myemailcrypt + "&password=" + mypasswordcrypt;
webView.postUrl(webserviceurl, EncodingUtils.getBytes(postData, "base64"));
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onReceivedTitle(WebView view, String sTitle) {
super.onReceivedTitle(view, sTitle);
if (sTitle != null && sTitle.length() > 0) {
if (sTitle.trim().equals("Success")) {
Success();
} else {
msgError(sTitle);
LoadProgress.dismiss();
}
} else {
msgError("Server Error !");
LoadProgress.dismiss();
}
}
});
LoadProgress = new ProgressDialog(this);
LoadProgress.setMessage("wait a moment...");
LoadProgress.show();
webView.setWebViewClient(new WebViewClient() {
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed() ;
}
});
AESCrypt mcrypt = new AESCrypt();
try {
myemailcrypt = AESCrypt.bytesToHex( mcrypt.encrypt(myemail) );
mypasswordcrypt = AESCrypt.bytesToHex( mcrypt.encrypt(mypassword) );
} catch (Exception e) {
}
String postData = "login=" + myemailcrypt + "&password=" + mypasswordcrypt;
webView.postUrl(webserviceurl, EncodingUtils.getBytes(postData, "base64"));
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onReceivedTitle(WebView view, String sTitle) {
super.onReceivedTitle(view, sTitle);
if (sTitle != null && sTitle.length() > 0) {
if (sTitle.trim().equals("Success")) {
Success();
} else {
msgError(sTitle);
LoadProgress.dismiss();
}
} else {
msgError("Server Error !");
LoadProgress.dismiss();
}
}
});
código diferente do convencional
Em 2 de dezembro de 2013 13:52, breno douglas araujo souza <breninho94@gmail.com> escreveu:
E quanto a questão das Activity's principais? .. quem você usa como Main no manifest? ..--
Em segunda-feira, 2 de dezembro de 2013 13h45min07s UTC-2, pakdroid escreveu:Aqui uso webview e sharedpreferencesEm 2 de dezembro de 2013 12:23, breno douglas araujo souza <breni...@gmail.com> escreveu:
Opa galera,--Estou fazendo uma acitivity para Login/Cadastre-se...Mas estou com algumas duvidas em relação ao manifest .. Devo colocar com activity main a activity de Login/Cadastre-se e depois de autenticação chamar a principal?..Ou teria como continuar com minha principal como MAIN e de alguma mandar o cara para a activity de login caso ele nao esteja autenticado?E como vocês normalmente fazem essa verificação, armazenam no sqlite um token da autenticação? .. Coloca na session usando shared preference?
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.






0 comentários:
Postar um comentário