Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – Probleme accessing url via volley

Posted on November 11, 2022 By

Solution 1 :

in you’r question you say : ‘I’m trying to get a json via an url’

but in you’r code you wirte ‘StringRequest’ . i think if you change StringRequest to JsonRequest problem solve.

Problem :

I’m trying to get a json via an url.
When I’m trying to access the url via my navigator, it’s work perfectly. But when I’m trying to access it via volley I got this error :

02-26 17:07:57.706 15056-15125/com.perso.simon.ulr_geoloc E/Volley: [5254] BasicNetwork.performRequest: Unexpected response code 403 for ...
02-26 17:07:57.716 15056-15125/com.perso.simon.ulr_geoloc E/Volley: [5254] BasicNetwork.performRequest: Unexpected response code 403 for ...
02-26 17:07:57.719 15056-15056/com.perso.simon.ulr_geoloc E/error: com.android.volley.AuthFailureError

I dont’t see where the error can be.

Here’s my code :

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash_screen);

    if(!isConnectedInternet(SplashScreenActivity.this)) {
        AlertDialog.Builder builder = new AlertDialog.Builder(SplashScreenActivity.this);

        builder.setPositiveButton(R.string.dialog_box_confirmation, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Intent i = new Intent(SplashScreenActivity.this, SplashScreenActivity.class);
                startActivity(i);
            }
        });

        builder.setMessage(R.string.dialog_box_text).setTitle(R.string.dialog_box_title);

        AlertDialog dialog = builder.create();
        dialog.show();
    } else {
        StringRequest requestBat = new StringRequest(urlBat, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                Log.e("test", response);
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e("error", error.toString());
            }
        });

        requestBat.setRetryPolicy(new DefaultRetryPolicy(10000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

        final RequestQueue requestQueue = Volley.newRequestQueue(SplashScreenActivity.this);
        requestQueue.add(requestBat);
    }
}

Comments

Comment posted by J.Doe

Unfortunately, problem not solved, the error is still the same. If you have other idea …

Comment posted by link

is this

READ  [FIXED] Android Gradle - Failed to resolve error when implementing Apache POI in gradle
Powered by Inline Related Posts
Android Tags:android, android-volley, authentication

Post navigation

Previous Post: [FIXED] android – how to change notification background color in nougat?
Next Post: [FIXED] android – How to make width ratio equal in XML GridView

Related Posts

[FIXED] android – Restoring notification after screen orientation change Android
[FIXED] android – Firestore toObject is slow Android
[FIXED] whenever i try running an app on Android studio 3.6. it brings this error… how can i fix this so that my apps can run in an emulator Android
[FIXED] android – Vimeo upload : unexpected status code (404) while resuming upload Android
[FIXED] Android studio shows “MainActivity.java uses or overrides a deprecated API.” but it also shows “Inspection of the code found nothing to report.” Android
[FIXED] xamarin.android – how i can set two listview in one page in xamarin Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can VPN be traced by police?
  • Where were Kaiser-Frazer cars built?
  • How do you make gold rose gold paint?
  • What are the newest type of dentures?
  • Can you wear joggers as dress pants?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme