Identify whether HTTP requests from Android App or not? and then respond appropriately

前端 未结 4 730
慢半拍i
慢半拍i 2021-01-31 23:21

My Android App has an App Widget associated with it which is updated every 10 minutes on an Android Device. These updates send HTTP requests for data to the servers and parse th

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 00:02

    When you create the HttpClient in android you can set the following

     client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "MY Android device identifier");
    

    This set the USER_AGENT for each http request send to your server. On your server you can retrieve the USER_AGENT to determine that the request came from your android device

提交回复
热议问题