security - Where to store a key in android? -
i developing mobile app retrieve data web server via web service call. calls different web services down using api key. question how , api key must stored? worth noting communication taken on https protocol.
you can use res->values->strings.xml
but if want make more secure can use api. suppose have api named www.myapikeysholder.com. api rechive post data "app_pkg" , if app package name provide api key response. , can save key in sqlite database or share performance.
sample come you:
// create asychttpclient object asynchttpclient client = new asynchttpclient(); // http request params object requestparams params = new requestparams(); params.put("app_pkg", getpackagename().tostring()); client.post("www.myapikeysholder.com", params, new asynchttpresponsehandler() { @override public void onsuccess(string response) { string api=response; //api give api key updatesqlite("api_key",api); } }); to support code need jar file.
https://www.dropbox.com/s/ofjcyo7zz1q86p7/android-async-http-1.3.1.jar
sorry bad english.
Comments
Post a Comment