본문 바로가기

안드로이드51

웹뷰 메소드 호출이 안될 때 (android.permission.INTERACT_ACROSS_USERS_FULL) 웹뷰(Javascript)와 안드로이드간 메소드를 호출하려고 하는데 , 안드로이드 > 자바스크립트로는 메소드 호출이 되지만 자바스크립트 > 안드로이드로는 메소드 호출이 안되는 경우가 있다. 오늘 이 현상때문에 개고생을 하다가 결국 원인을 찾아냈다. 수없이 올라오는 로그를 자세히 보니 웹뷰에서 안드로이드의 메소드를 호출 할 때 Writing exception to parceljava.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULLat co.. 2015. 12. 15.
캐시 삭제 캐시 삭제하기 여러가지 내장 컴포넌트들을 사용하다보면 예상하지 못한 캐시가 많이 생성됩니다. 저는 웹뷰를 주로 많이 쓰는데요~ 쓰다보면 내장메모리에 몇메가까지 캐시가 생기더라고요~ webview.clearChache 메써드를 수시로 사용해도 완전히 지워지지 않습니다. 종료시점이나 사용자 메뉴에 아래처럼 쓰시면 바로 0으로 줄어드네요^^ private void clearApplicationCache(java.io.File dir){ if(dir==null) dir = getCacheDir(); else; if(dir==null) return; else; java.io.File[] children = dir.listFiles(); try{ for(int i=0;i 2015. 12. 15.
http request First of all, request a permission to access network, add following to your manifest:Then the easiest way is to use Apache http client bundled with Android: HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(new HttpGet(URL)); StatusLine statusLine = response.getStatusLine(); if(statusLine.getStatusCode() == HttpStatus.SC_OK){ ByteArrayOutputStream out = .. 2015. 12. 15.
http post get 전송 1.Get 방식 example) { ... String result = sendData("http://xxx.xxx.xxx/xxx.asp?title=leeminjung&type=article"); ... } private static String sendData(String addr){ StringBuilder html = new StringBuilder(); try{ URL url = new URL(addr); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); if(conn != null){ conn.setConnectTimeout(10000); conn.setUseCaches(false); if(conn.getResponseCode(.. 2015. 12. 15.