• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

About Ringtones

I've downloaded Google contact app, and now all I have to figure out Ida how to make it the default app.
Depending on which Android version you're using, your path may be different, but it should be similar to this:

System Settings | Apps & Notifications | Advanced | Default Apps

Hopefully, you'll then see an entry for Contacts (I don't, but I only have one installed), and selecting it should allow you to choose Google's app as the default.
Thank you.
You're welcome. :)

Rest api in android

Try this

Java:
public final class FromUrlHelper {

    public static JSONObject getJSONObject(String url) throws IOException {
        if (Constants.debug) Log.d("API Call", url);
        JSONObject jsonObject = null;
        try {
            jsonObject = new JSONObject(FromUrlHelper.getJSONFromUrl(url));
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return jsonObject;
    }
}

then call for example API like this

Java:
public class AuthService {
    private static AuthService ourInstance = null;

    public static AuthService getInstance() {
        if (ourInstance == null) {
            ourInstance = new AuthService();
        }

        return ourInstance;
    }

    private String currentSession;
    private boolean loggined;

    private AuthService() {
    }

    public boolean login(String email, String password) {

        if (!email.isEmpty() && !password.isEmpty()) {
            try {
                JSONObject result = FromUrlHelper.getJSONObject(Constants.serviceBaseUrl + "login?email=" + email + "&password=" + password);
                try {
                    int errorCode = result.getInt("errorCode");
                    if (errorCode == 0) {
                        this.currentSession = result.getString("sessionId");
                        loggined = true;
                        return true;
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        return false;
    }

    public boolean logout() {
        loggined = false;
        this.currentSession = null;
        return true;
    }
}

In Activity you can call this

Code:
AuthService authService = AuthService.getInstance();

if(authService.login("email","password")) {
    // do something
} else {
    // do something
}

In PHP API server it can look like this.

PHP:
        $customer = $this->entityManager->getRepository(Customer::class)->findOneBy(['email' => $request->get('email'), 'password' => md5($request->get('password')), 'eshop' => $eshop]);
        if ($customer) {
            /** @var Session $session */
            $session = $this->getSessionFromCustomer($customer);
            if(!$session) {
                $sessionId = $this->createSession($customer);
            } else {
                $sessionId = $session->getCode(); 
            }
            $response->errorCode = self::ERR_OK;
        } else {
            $sessionId = null;
            $response->errorCode = self::ERR_AUTH;
        }

        $response->sessionId = $sessionId;

        return new JsonResponse($response);

Next in contactless payments...Smile to Pay.

Having been an Annual Passholder for what I believe to be twice in the last ten years, I am fully aware and have experience with that personally. There is no way out of it, I guess.

I have used those Disney fingerprint scanners at Shanghai and Hong Kong Disney parks, and I now know their real purpose, to stop people cheating with the season passes. But they did give me thoughts of big brother 1984, and chilling effects. Especially as the only other organization that's taken an interest in recording my fingerprints is the Ministry of Public Security of the PRC, and have to use similar scanners to the Disney ones every-time I pass through Beijing Airport.

Does The Walt Disney Company give law enforcement and other govt TLAs access to their fingerprint database?

No sound from phone speakers on Bluetooth

Up until about a month ago, if I connected my phone via Bluetooth to my car, my phone notifications still made sound on the phone. Then an app called Smart Things seemed to hijack my phone any time I used Bluetooth. Do I need to be using that app to play through the car speakers (which I do with podcasts, etc). I still want my phone to play the notifications.

I did turn off (force stop) Smart Things, but the notifications still aren't playing when on Bluetooth. Any ideas what I've done?

AsyncThread cancelled even is success background opration onPostExecute not called

I found solution error was in the wrong URL of API service it causes that returns HTML 404 instead of JSON


Hi,

i have problem with my application, i have following AsyncTask and even is
executed it goes to onCancelled instead of onPostExecute.
Java:
    private class UserRegisterTask extends AsyncTask<Boolean, Boolean, Boolean> {

        private final String mEmail;
        private final String mPassword;
        private final String mFirstName;
        private final String mLastName;
        private final String mAddress1;
        private final String mAddress2;
        private final String mCity;
        private final String mZip;
        private final String mState;
        private final ProgressDialog dialog;
        private final boolean mNewsletter;

        private boolean registered = false;

        public UserRegisterTask(Activity activity, String email, String password, String firstname, String lastname, String address1, String address2, String city, String zip, String state, boolean newsletter) {
            mEmail = email;
            mPassword = password;
            mFirstName = firstname;
            mLastName = lastname;
            mAddress1 = address1;
            mAddress2 = address2;
            mCity = city;
            mZip = zip;
            mState = state;
            mNewsletter = newsletter;
            dialog = new ProgressDialog(activity);
        }


        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            registering = true;
            dialog.setMessage("Registruji a přihlašuji, prosím čekejte...");
            dialog.setCanceledOnTouchOutside(false);
            dialog.show();
        }

        @Override
        protected void onCancelled() {
            super.onCancelled();
            dialog.dismiss();
            registering = false;
            Toast.makeText(getBaseContext(), R.string.registration_cancelled, Toast.LENGTH_SHORT).show();
        }

        @Override
        protected Boolean doInBackground(Boolean... booleans) {
            registered = authService.register(mFirstName, mLastName, mEmail, mPassword, mCity, mAddress1, mAddress2, mZip, mState, mNewsletter);
            return Boolean.TRUE;
        }

        @Override
        protected void onPostExecute(Boolean success) {
            super.onPostExecute(success);
            dialog.dismiss();

            if (success && registered) {
                Toast.makeText(getBaseContext(), R.string.registration_success, Toast.LENGTH_LONG).show();
                redirectToHomepage();
            } else {
                email.setError(getString(R.string.email_is_already_registered));
                email.requestFocus();
            }
        }
    }

Filter

Back
Top Bottom