반응형
test device : note 4
android os : Marshmallow 6.0
설명 없음.
알아서 보시기 바람. 소스 full로 올림.
Source
BlueToothData.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <code> public class BlueToothData implements Serializable { private SettingValue.BT_MESSAGE_TYPE message_type; private String fileName; private byte [] data; public SettingValue.BT_MESSAGE_TYPE getMessage_type() { return message_type; } public void setMessage_type(SettingValue.BT_MESSAGE_TYPE message_type) { this .message_type = message_type;} public String getFileName() { return fileName; } public void setFileName(String fileName) { this .fileName = fileName; } public byte [] getData() { return data; } public void setData( byte [] data) { this .data = data; } } </code> |
SettingValue.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <code> package com.example.sampleproject.Data; import java.util.UUID; public class SettingValue { //블루투스 장치 식별 번호 public static final UUID BT_UUID= UUID.fromString( "00001101-0000-1000-8000-00805F9B34FB" ); public static final int BT_SEND_DATABUFFER_SIZE = 10485760 ; //10M 10485760 public static final int BT_SEND_BYTE_SIZE = 512 ; public static final int BT_REQ_ENABLE= 10 ; public static final int BT_REQ_DISCOVERYABLE= 20 ; public enum BT_MESSAGE_TYPE{ TEXT, FILE; } } </code> |
AndroidManifest.xml add 일부.. 필요??? 정확히 기억안남. ㅡㅡa 필요 없는 것도 있을 수 있음.
1 2 3 4 5 6 | <code> <uses-permission android:name= "android.permission.BLUETOOTH" /> <uses-permission android:name= "android.permission.BLUETOOTH_ADMIN" /> <!-- BLUETOOTH 권한 마시멜로우 버전부터 주번 기기를 탐색할 때 필요함. 클라이언트만 필요 --> <uses-permission android:name= "android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name= "android.permission.WRITE_EXTERNAL_STORAGE" /> </code> |
*NorangActivity는 기본 Activity사용하면 됨.
이것으로 인한 듣보잡 메서드는 삭제 하면 잘 돌아 갈 것임...
Marshmallow 6.0에서만 테스트 되었음. 그 이외의 버전은... 안될 수 있음...
반응형
'Android' 카테고리의 다른 글
Bluetooth file & text transfer #3 client (4) | 2021.03.17 |
---|---|
Bluetooth file & text transfer #2 server (4) | 2021.03.17 |
Android ListView Sorting (6) | 2021.01.03 |
Android Error Message (2) | 2021.01.01 |
자주 쓰는 코드 모음. (4) | 2020.10.30 |
댓글