JAVA/android_studio 2024. 9. 16. 11:16

 

https://stackoverflow.com/questions/51357772/android-service-not-restarted-when-app-back-from-idle-state

 

Android service not restarted when app back from idle state

I've upgraded my app to API 26 and I'm facing some issues with the new background execution limits. On Oreo devices, as soon as my app goes in background, my app is stopped by the OS due to idle s...

stackoverflow.com

 

서비스 실행후 서비스포그라운드 를 제한시간이내에 호출해줘야 함. 

posted by cskimair
:
JAVA/android_studio 2024. 9. 16. 11:11

 

https://stackoverflow.com/questions/52382710/permission-denial-startforeground-requires-android-permission-foreground-servic

 

Permission Denial: startForeground requires android.permission.FOREGROUND_SERVICE

Lately we have suddenly been seeing a few of the following stack traces. Why could that be? This is from when the app tries to move an audio commentary service into the foreground with a media

stackoverflow.com

 

From the migration notes for Android 9:

Apps wanting to use foreground services must now request the FOREGROUND_SERVICE permission first. This is a normal permission, so the system automatically grants it to the requesting app. Starting a foreground service without the permission throws a SecurityException.

The solution is to just add the following in AndroidManifest.xml:

<manifest ...>
     ...
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
     ...
     <application ...>
     ...
</manifest>
posted by cskimair
:
JAVA/android_studio 2024. 9. 16. 11:09

 

https://stackoverflow.com/questions/31279216/how-to-add-an-item-to-a-listview-with-each-button-click

 

How to add an item to a ListView with each Button click

This is the code I'm working on, it should simply add an item in a ListView (w/ array) each time the Button is clicked. The text inserted by the user on a EditText should be added to the list each ...

stackoverflow.com

 

Button buttonPlus = (Button)findViewById(R.id.buttonPlus);

        buttonPlus.setOnClickListener(
                new Button.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        arrayNames.add(0, namesText.getText().toString());
                        adapterNames.notifyDataSetChanged();
                        namesText.setText("");

                    }
                }
        );

 

 

 

posted by cskimair
:
JAVA/android_studio 2024. 9. 16. 11:03

 

[Java/Android] 현재 날짜, 시간 출력 SimpleDateFormat

출처: https://kong-droid.com/entry/AndroidJava-현재-날짜-시간-출력-SimpleDateFormat [Kong-droid:티스토리]

- 사용예.

 

SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS") ;//밀리초 단위로 표시
String time = sdf.format (System.currentTimeMillis());

adapter.add( time +"]" + message) ;
adapter.notifyDataSetChanged();

posted by cskimair
:
JAVA/android_studio 2024. 9. 10. 14:19

 

- 서비스 사용 예제

https://stickode.tistory.com/736

 

[Android][Java] Service 사용 이해를 위한 예제(1)

오늘은 간단한 예제를 통해 안드로이드 서비스의 동작 방식을 익혀 보도록 하겠습니다. Service ? 백그라운드에서 오랜 작업을 수행할 수 있는 앱 구성요소로써 사용자 인터페이스가 제공되지 않

stickode.tistory.com

 

posted by cskimair
:
JAVA/android_studio 2024. 9. 10. 00:56

- 핸들러 , Handler

https://junyoung-developer.tistory.com/116

 

[Android] 핸들러(Handler)

모든 내용은 Do it! 안드로이드 앱 프로그래밍을 바탕으로 정리한 것입니다. 핸들러(Handler) 새로운 프로젝트를 만들면 자동으로 생성되는 메인 액티비티는 앱이 실행될 때 하나의 프로세스에서

junyoung-developer.tistory.com

 

 

- https://brunch.co.kr/@mystoryg/84

 

안드로이드 Handler 알고 쓰자

Message Queue & Looper | 안드로이드 개발자라면 UI 작업은 별도의 스레드(이하 워커 스레드(worker thread))가 아닌 메인 스레드(main thread)에서 해야 한다는 이야기를 들어봤을 것이다. 만약 로직상 워커

brunch.co.kr

 

> https://50billion-dollars.tistory.com/entry/Android-%EC%8A%A4%EB%A0%88%EB%93%9C%EC%99%80-%ED%95%B8%EB%93%A4%EB%9F%AC

 

[Android] 스레드와 핸들러

https://survivalcoding.com/p/android_basic 될 때까지 안드로이드 될 때까지 안드로이드에 수록된 예제의 라이브 코딩 해설 survivalcoding.com 위 서적을 참고하였습니다. 이번 시간에는 비동기 처리의 대표적

50billion-dollars.tistory.com

 

https://velog.io/@dlrmwl15/%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-%EC%8A%A4%EB%A0%88%EB%93%9CThread%EC%99%80-%ED%95%B8%EB%93%A4%EB%9F%ACHandler

 

[안드로이드] 스레드(Thread)와 핸들러(Handler)

스레드(Thread)란 동시 작업을 위한 하나의 실행 단위입니다.앱을 실행하면 메인 스레드라는 하나의 스레드가 시작되는데이 메인 스레드는 앱의 기본 실행을 담당합니다.만약 사용자가 필요에 따

velog.io

* google search about Handler

> https://www.google.com/search?client=firefox-b-d&q=%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C+%EC%9E%90%EB%B0%94%2C+%ED%95%B8%EB%93%A4%EB%9F%AC+

 

🔎 안드로이드 자바, 핸들러 : Google 검색

 

www.google.com

 

- Bundle

https://lamlic36.tistory.com/17

 

안드로이드 번들(Bundle)

액티비티 간 데이터 송수신 예제(추후 보완 수정 작업 예정) 간단 설명 - 두개의 액티비티 사이에 번들을 통해 데이터 송수신 예제 - 본 페이지에선 Bundle 내에 문자열, 정수, 문자열 배열, 정수 배

lamlic36.tistory.com

 

https://velog.io/@ilil1/%EA%B0%9C%EB%85%90-%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-Bundle%EB%A1%9C-Data-%EC%A0%84%EB%8B%AC

 

[개념] 안드로이드 Bundle(번들)로 Data 전달

1. Bundle의 개념 2. Bundle의 활용

velog.io

 

 

posted by cskimair
: