Note that there are some explanatory texts on larger screens.

plurals
  1. POGet GCM Registration id using asynctask
    primarykey
    data
    text
    <p>I used this script to get registration id in <code>doInbackground</code> AsyncTask but registration id still empty. No error or forced closed but registration id empty.</p> <pre><code>public class RegisterTask extends AsyncTask&lt;String, Void, Integer&gt; { public RegisterTask(RegisterActivity activity, ProgressDialog progressDialog) { this.activity = activity; this.progressDialog = progressDialog; } @Override protected void onPreExecute() { progressDialog.show(); } @Override protected Integer doInBackground(String... arg0) { inputFullName = (EditText) activity.findViewById(R.id.registerName); inputEmail = (EditText) activity.findViewById(R.id.registerEmail); inputPassword = (EditText) activity.findViewById(R.id.registerPassword); String name = inputFullName.getText().toString(); String email = inputEmail.getText().toString(); String password = inputPassword.getText().toString(); Log.v(email, password); UserFunctions userFunction = new UserFunctions(); // Make sure the device has the proper dependencies. GCMRegistrar.checkDevice(activity); // Make sure the manifest was properly set - comment out this line // while developing the app, then uncomment it when it's ready. GCMRegistrar.checkManifest(activity); // lblMessage = (TextView) findViewById(R.id.lblMessage); activity.registerReceiver(activity.mHandleMessageReceiver, new IntentFilter(DISPLAY_MESSAGE_ACTION)); // Get GCM registration id regId = GCMRegistrar.getRegistrationId(activity); JSONObject json = userFunction.registerUser(name, email, password, regId); // check for login response try { if (json.getString(KEY_SUCCESS) != null) { // registerErrorMsg.setText(""); String res = json.getString(KEY_SUCCESS); if (Integer.parseInt(res) == 1) { // user successfully registred // Store user details in SQLite Database DatabaseHandler db = new DatabaseHandler( activity.getApplicationContext()); JSONObject json_user = json.getJSONObject("user"); // Clear all previous data in database userFunction.logoutUser(activity.getApplicationContext()); db.addUser(json_user.getString(KEY_ID_USER), json_user.getString(KEY_NAMA), json_user.getString(KEY_EMAIL), json_user.getString(KEY_REGID), json_user.getString(KEY_JKEL), json_user.getString(KEY_TLAHIR), json_user.getString(KEY_INSTANSI), json_user.getString(KEY_JABATAN), json_user.getString(KEY_DIBUAT_AT), json_user.getString(kEY_AVATAR), json_user.getString(kEY_STATUS)); // successful registration responseCode = 1; } else { // Error in registration responseCode = 0; } } } catch (JSONException e) { e.printStackTrace(); } return responseCode; } @Override protected void onPostExecute(Integer responseCode) { EditText userName = (EditText) activity .findViewById(R.id.registerEmail); EditText passwordEdit = (EditText) activity .findViewById(R.id.registerPassword); String s = userName.getText().toString(); if (responseCode == 1) { progressDialog.dismiss(); activity.registerReport(responseCode); userName.setText(""); passwordEdit.setText(""); } if (responseCode == 0) { progressDialog.dismiss(); activity.registerReport(responseCode); } } } </code></pre> <p>please help</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload