val locationRequest2 = LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY,2000) //2초마다 인터발
            .setWaitForAccurateLocation(false)
            .setMinUpdateIntervalMillis(500)
            .setMaxUpdateDelayMillis(1000)
            .build();

/*
        val locationRequest = LocationRequest.create()?.apply {
            priority = LocationRequest.PRIORITY_HIGH_ACCURACY
            interval = 2 * 1000
            fastestInterval = 1 * 1000

        }
*/

주석과같이 쓰시던 내용을 변경해주시면 되겠습니다 -끗0

'프로그래밍 > kotlin' 카테고리의 다른 글

[kotlin]내부저장소 사용하기  (0) 2023.03.17
리사이클러뷰 뷰가 꼬일때  (0) 2023.01.05
[kotlin]Handler deprecated  (0) 2022.11.10
[kotlin] vibrator Deprecated  (0) 2022.11.10
[코틀린] 핸들러  (0) 2022.07.20
/* val vibrator = getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
                    vibrator.vibrate(500)*/

                    val vibrator = if( Build.VERSION.SDK_INT >=Build.VERSION_CODES.S){
                        val vibeManager : VibratorManager = getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager

                        vibeManager.defaultVibrator
                    }else{
                        @Suppress("DEPRECATION")
                       getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
                    }

                    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){ // api level 26 이상
                        vibrator.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE))
                    }else {
                        vibrator.vibrate(500)
                    }

기존에 주석처럼 사용하던것을 아래와 같이 버전 체크를 통해 변경해주시면 됩니다. -끗

'프로그래밍 > kotlin' 카테고리의 다른 글

[kotlin]내부저장소 사용하기  (0) 2023.03.17
리사이클러뷰 뷰가 꼬일때  (0) 2023.01.05
[kotlin]Handler deprecated  (0) 2022.11.10
[kotlin]locationRequest Deprecated  (0) 2022.11.10
[코틀린] 핸들러  (0) 2022.07.20

platform-tools 설치확인

D:\slsolution\platform-tools

 

 - 안드로이드 스튜디오가 설치된 PC와 USB 연결
 - 스마트폰의 화면을 끔
 - 어플에서 특정 기능을 테스트하는 경우, 어플을 킨 후 테스트할 항목을 진행 시킨 후에 화면을 끔

 

adb devices 디바이스 연결확인

 

  1. 다음 명령어를 실행하여 강제로 시스템을 유휴 모드로 지정합니다.
     
        $ adb shell dumpsys deviceidle force-idle
        
  2. 준비가 되면 다음 명령어를 실행하여 유휴 모드를 종료합니다.
     
        $ adb shell dumpsys deviceidle unforce
        
  3. 다음 명령어를 실행하여 기기를 다시 활성화합니다.
     
        $ adb shell dumpsys battery reset
          
    private class TextHandler(service: SendLocationService) : Handler() {
         val serviceWeak: WeakReference<SendLocationService>

        override fun handleMessage(msg: Message) {
            super.handleMessage(msg)
            val service = serviceWeak.get()
            if (msg.what ==1) {
                service?.setMyTextHandler(msg.data)
            }
        }
        init {
            serviceWeak = WeakReference(service)
        }
    }
    fun setMyTextHandler(data: Bundle){
        val abc = data.getString("abc");
    }
		var handler = TextHandler(this);

        val msg = Message();
        msg.what =1;

        msg.data = Bundle();
        msg.data.putString("abc","dddd");

        handler.sendMessage(msg);

'프로그래밍 > kotlin' 카테고리의 다른 글

[kotlin]내부저장소 사용하기  (0) 2023.03.17
리사이클러뷰 뷰가 꼬일때  (0) 2023.01.05
[kotlin]Handler deprecated  (0) 2022.11.10
[kotlin]locationRequest Deprecated  (0) 2022.11.10
[kotlin] vibrator Deprecated  (0) 2022.11.10

Cannot run with sound null safety, because the following dependencies don't support null safety: - package:english_words

 

Run/Debug configurations 

Additional run args: --no-sound-null-safety 입력

 

or

pubspec.yaml 을

sdk 버전 변경 

기존 sdk 2.15.0 -> 2.7.0 으로 변경

sdk: ">=2.7.0 <3.0.0"

리스트 데이터 ~

		HashMap<String, String> data = new HashMap<String, String>();
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat fomat = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREA);
		cal.add(cal.DATE, -1);
		String yesterday = fomat.format(cal.getTime());
		JSONArray responseArray = null;
		JSONObject responseObject = null;
		JSONObject responseObject2 = null;
 
		StringBuilder sb = new StringBuilder();
        try{
            String url = "http://host/getCommonSelect?date=" + yesterday;
			URL obj = new URL(url);
			HttpURLConnection con = (HttpURLConnection) obj.openConnection();
			con.setRequestMethod("GET");
			BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
			String line;
			while ((line = br.readLine()) != null) {
				sb.append(line);
				responseObject = new JSONObject(sb.toString());
			}
			responseArray = new JSONArray(responseObject.get("list").toString());
			if (responseArray.length() == 0) {
				throw new Exception();
			}
			for (int i = 0; i < responseArray.length(); i++) {
				responseObject2 = new JSONObject(responseArray.get(i).toString());
				HashMap<String, Object> params = new HashMap<String, Object>();
				params.put("data_name", responseObject2.get("data"));
                
                }
          }catch(Exception e){
          e.printStackTrace();
          }

 

'프로그래밍 > Java,eclipse' 카테고리의 다른 글

http multipartRequest 사진전송,파일전송 (저장용)  (0) 2021.07.15
이해하기 폴리곤 알고리즘  (0) 2019.05.23
eclipse SVN 설치중 오류  (0) 2019.05.02
배경 테마 바꾸기  (0) 2018.10.25
연산자의 종류  (0) 2018.10.25
//보내는부분
private void Fnc(File uploadFile){
try {
			String url = "Http://host/getURL";
			String charset = "UTF-8";
			File binaryFile = uploadFile;
			String boundary = Long.toHexString(System.currentTimeMillis());
			String CRLF = "\r\n";

			URLConnection connection = new URL(url).openConnection();
			connection.setDoOutput(true);
			connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);

			OutputStream output = null;
			try {
				output = connection.getOutputStream();
				PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, charset), true);
				// Send binary file.
				writer.append("--" + boundary).append(CRLF);
				writer.append("Content-Disposition: form-data; name=\"binaryFile\"; filename=\"" + binaryFile.getName() + "\"").append(CRLF);
				writer.append("Content-Type: " + URLConnection.guessContentTypeFromName(binaryFile.getName())).append(CRLF);
				writer.append("Content-Transfer-Encoding: binary").append(CRLF);
				writer.append(CRLF).flush();
				Files.copy(binaryFile.toPath(), output);
				output.flush(); // Important before continuing with writer!
				writer.append(CRLF).flush(); // CRLF is important! It indicates end of boundary.

				// End of multipart/form-data.
				writer.append("--" + boundary + "--").append(CRLF).flush();
			} catch (Exception e) {
				e.printStackTrace();
			}
			int responseCode = ((HttpURLConnection) connection).getResponseCode();
			System.out.println(responseCode); // Should be 200

		} catch (Exception e) {
			e.printStackTrace();
		}
}

//받는부분
@RequestMapping(value = "/getURL", method = RequestMethod.POST)
	private void getURL(HttpServletRequest request, HttpServletResponse response) throws Exception {

		
		MultipartResolver resolver = new CommonsMultipartResolver(request.getSession().getServletContext());
		MultipartHttpServletRequest multipartRequest = resolver.resolveMultipart(request);

		File directory = CommonUtil.getImageDirectory(multipartRequest);

		Iterator<String> iterator = multipartRequest.getFileNames();
		int successCount = 0;
		while (iterator.hasNext()) {
			MultipartFile multipartFile = multipartRequest.getFile(iterator.next());
			multipartFile.getSize();

			String fileName = multipartFile.getOriginalFilename();

			File uploadFile = new File(directory, fileName);
			multipartFile.transferTo(uploadFile);
		}
	

	}
    
    
//디렉터리 생성 유틸

		//로컬
		 ServletContext servlet = request.getSession().getServletContext();
		 String root = servlet.getRealPath("/") + UPLOAD_FOLDER + File.separator;

		//서버
		//String root = "/data" + File.separator + UPLOAD_FOLDER + File.separator;

		System.out.println("root = " + root);

		String dayPath = new SimpleDateFormat("yyMMdd").format(new Date());

		dayPath = root + File.separator + dayPath;

		File dayDirectory = new File(dayPath);
		if (!dayDirectory.isDirectory()) {
			dayDirectory.mkdirs();
		}

		int subCount = dayDirectory.listFiles().length;

		if (subCount == 0) {
			String subPath = dayDirectory + File.separator + subCount;
			File subDirectory = new File(subPath);
			subDirectory.mkdirs();
			return subDirectory;
		} else {
			String subPath = dayDirectory + File.separator + (subCount - 1);
			File subDirectory = new File(subPath);
			if (subDirectory.isDirectory()) {
				if (subDirectory.listFiles().length > 0) {
					subPath = dayDirectory + File.separator + subCount;
					subDirectory = new File(subPath);
					subDirectory.mkdirs();
				}
			} else {
				subDirectory.mkdirs();
			}
			return subDirectory;
		}

 

'프로그래밍 > Java,eclipse' 카테고리의 다른 글

httpConnection 으로 데이터 받기 (저장용)  (0) 2021.07.15
이해하기 폴리곤 알고리즘  (0) 2019.05.23
eclipse SVN 설치중 오류  (0) 2019.05.02
배경 테마 바꾸기  (0) 2018.10.25
연산자의 종류  (0) 2018.10.25
window.dispatchEvent(new Event('resize'));

윈도우를 강제로 리사이즈 할 수 있습니다 .

차트 크기변경이나 

맵 api 타일 미변경에 의한 리사이즈등 사용하면 좋습니다.

+ Recent posts