Android - 403 when requesting map image with valid API key





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I'm trying to load a static map API image, but it keeps 403-ing, which seems to be because of an invalid API key (based on the docs https://developers.google.com/maps/documentation/maps-static/error-messages)



I've verified in the console that the API key is valid and non-expired. The url https://maps.googleapis.com/maps/api/staticmap?center=47.3,-122.359&zoom=12&size=411x231&maptype=roadmap&mobile=true&scale=2&key=xxxxx loads fine in the browser, so I take that to mean that the API key is valid.



The API key lives in the AndroidManifest.xml file



<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxx"/>


Anyone else experience this?










share|improve this question























  • The error might occur if you did not enable your billing account or if you reached your self-imposed usage cap.

    – Shawn Domingo
    Jan 22 at 0:57


















1















I'm trying to load a static map API image, but it keeps 403-ing, which seems to be because of an invalid API key (based on the docs https://developers.google.com/maps/documentation/maps-static/error-messages)



I've verified in the console that the API key is valid and non-expired. The url https://maps.googleapis.com/maps/api/staticmap?center=47.3,-122.359&zoom=12&size=411x231&maptype=roadmap&mobile=true&scale=2&key=xxxxx loads fine in the browser, so I take that to mean that the API key is valid.



The API key lives in the AndroidManifest.xml file



<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxx"/>


Anyone else experience this?










share|improve this question























  • The error might occur if you did not enable your billing account or if you reached your self-imposed usage cap.

    – Shawn Domingo
    Jan 22 at 0:57














1












1








1








I'm trying to load a static map API image, but it keeps 403-ing, which seems to be because of an invalid API key (based on the docs https://developers.google.com/maps/documentation/maps-static/error-messages)



I've verified in the console that the API key is valid and non-expired. The url https://maps.googleapis.com/maps/api/staticmap?center=47.3,-122.359&zoom=12&size=411x231&maptype=roadmap&mobile=true&scale=2&key=xxxxx loads fine in the browser, so I take that to mean that the API key is valid.



The API key lives in the AndroidManifest.xml file



<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxx"/>


Anyone else experience this?










share|improve this question














I'm trying to load a static map API image, but it keeps 403-ing, which seems to be because of an invalid API key (based on the docs https://developers.google.com/maps/documentation/maps-static/error-messages)



I've verified in the console that the API key is valid and non-expired. The url https://maps.googleapis.com/maps/api/staticmap?center=47.3,-122.359&zoom=12&size=411x231&maptype=roadmap&mobile=true&scale=2&key=xxxxx loads fine in the browser, so I take that to mean that the API key is valid.



The API key lives in the AndroidManifest.xml file



<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxx"/>


Anyone else experience this?







android google-maps google-static-maps






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 21:42









Lady_ariLady_ari

2742619




2742619













  • The error might occur if you did not enable your billing account or if you reached your self-imposed usage cap.

    – Shawn Domingo
    Jan 22 at 0:57



















  • The error might occur if you did not enable your billing account or if you reached your self-imposed usage cap.

    – Shawn Domingo
    Jan 22 at 0:57

















The error might occur if you did not enable your billing account or if you reached your self-imposed usage cap.

– Shawn Domingo
Jan 22 at 0:57





The error might occur if you did not enable your billing account or if you reached your self-imposed usage cap.

– Shawn Domingo
Jan 22 at 0:57












2 Answers
2






active

oldest

votes


















0














Can you post code for how you are accessing and building the url to be sent?



Also if you are on a premium plan, then you will need to add a signature metadata field as described here: https://developers.google.com/maps/documentation/maps-static/get-api-key?hl=en_US#dig-sig-key.






share|improve this answer
























  • So, I did a bit of digging, and it seems like Google changed it so that the url requires the key to be sent on Android as well. It's no longer enough to have the API key in the AndroidManifest.xml file. This is terrible, since it breaks older app versions that used the old structure.

    – Lady_ari
    Nov 16 '18 at 22:09



















0














So, I did a bit of digging, and it seems like Google made a change in June of this year where the url now requires the key to be sent. They no longer support keyless usage. This is terrible, since it breaks older app versions that used the old structure.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345821%2fandroid-403-when-requesting-map-image-with-valid-api-key%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Can you post code for how you are accessing and building the url to be sent?



    Also if you are on a premium plan, then you will need to add a signature metadata field as described here: https://developers.google.com/maps/documentation/maps-static/get-api-key?hl=en_US#dig-sig-key.






    share|improve this answer
























    • So, I did a bit of digging, and it seems like Google changed it so that the url requires the key to be sent on Android as well. It's no longer enough to have the API key in the AndroidManifest.xml file. This is terrible, since it breaks older app versions that used the old structure.

      – Lady_ari
      Nov 16 '18 at 22:09
















    0














    Can you post code for how you are accessing and building the url to be sent?



    Also if you are on a premium plan, then you will need to add a signature metadata field as described here: https://developers.google.com/maps/documentation/maps-static/get-api-key?hl=en_US#dig-sig-key.






    share|improve this answer
























    • So, I did a bit of digging, and it seems like Google changed it so that the url requires the key to be sent on Android as well. It's no longer enough to have the API key in the AndroidManifest.xml file. This is terrible, since it breaks older app versions that used the old structure.

      – Lady_ari
      Nov 16 '18 at 22:09














    0












    0








    0







    Can you post code for how you are accessing and building the url to be sent?



    Also if you are on a premium plan, then you will need to add a signature metadata field as described here: https://developers.google.com/maps/documentation/maps-static/get-api-key?hl=en_US#dig-sig-key.






    share|improve this answer













    Can you post code for how you are accessing and building the url to be sent?



    Also if you are on a premium plan, then you will need to add a signature metadata field as described here: https://developers.google.com/maps/documentation/maps-static/get-api-key?hl=en_US#dig-sig-key.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 16 '18 at 22:01









    Eric CEric C

    12




    12













    • So, I did a bit of digging, and it seems like Google changed it so that the url requires the key to be sent on Android as well. It's no longer enough to have the API key in the AndroidManifest.xml file. This is terrible, since it breaks older app versions that used the old structure.

      – Lady_ari
      Nov 16 '18 at 22:09



















    • So, I did a bit of digging, and it seems like Google changed it so that the url requires the key to be sent on Android as well. It's no longer enough to have the API key in the AndroidManifest.xml file. This is terrible, since it breaks older app versions that used the old structure.

      – Lady_ari
      Nov 16 '18 at 22:09

















    So, I did a bit of digging, and it seems like Google changed it so that the url requires the key to be sent on Android as well. It's no longer enough to have the API key in the AndroidManifest.xml file. This is terrible, since it breaks older app versions that used the old structure.

    – Lady_ari
    Nov 16 '18 at 22:09





    So, I did a bit of digging, and it seems like Google changed it so that the url requires the key to be sent on Android as well. It's no longer enough to have the API key in the AndroidManifest.xml file. This is terrible, since it breaks older app versions that used the old structure.

    – Lady_ari
    Nov 16 '18 at 22:09













    0














    So, I did a bit of digging, and it seems like Google made a change in June of this year where the url now requires the key to be sent. They no longer support keyless usage. This is terrible, since it breaks older app versions that used the old structure.






    share|improve this answer




























      0














      So, I did a bit of digging, and it seems like Google made a change in June of this year where the url now requires the key to be sent. They no longer support keyless usage. This is terrible, since it breaks older app versions that used the old structure.






      share|improve this answer


























        0












        0








        0







        So, I did a bit of digging, and it seems like Google made a change in June of this year where the url now requires the key to be sent. They no longer support keyless usage. This is terrible, since it breaks older app versions that used the old structure.






        share|improve this answer













        So, I did a bit of digging, and it seems like Google made a change in June of this year where the url now requires the key to be sent. They no longer support keyless usage. This is terrible, since it breaks older app versions that used the old structure.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 22:11









        Lady_ariLady_ari

        2742619




        2742619






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345821%2fandroid-403-when-requesting-map-image-with-valid-api-key%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python