2012-07-14 2 views
0

나는 블루투스 장치가 도달 할 때 활동을 시작하고 장치가 도달 할 때 다시 시작해야하는 Android에 앱을 작성 중입니다. 액티비티를 시작하고 중지 할 때이를 표시기로 사용하기 만하면 장치에 연결할 필요가 없습니다. 이 작업을 수행하는 가장 좋은 방법은 무엇입니까?블루투스 장치가 안드로이드에 도달했을 때 활동을 시작하는 가장 좋은 방법

미리 감사드립니다. 매니페스트 ACL_CONNECTED에 대한

+0

이것은 너무 리소스 집약적이어서 실용적이지 않을 것입니다. 블루투스 장치를 검색하는 것은 값 비싼 작업입니다. –

답변

0

선언 수신기 : YourBroadcastReciver 당신이 무엇을해야하지만, 일부 status notification를 숨기기/더 나은 공연이 될 것입니다 (이 사용자에 대한 성가신 것) 새로운 활동을 표시하지 않습니다에 그런

<uses-permission android:name="android.permission.BLUETOOTH" /> 
<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 
    <receiver android:name=".YourBroadcastReciver"> 
     <intent-filter > 
      <action android:name="android.bluetooth.device.action.ACL_CONNECTED" /> 
      <action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" /> 
     </intent-filter> 
    </receiver> 
</application> 

.

+0

Spot on. 감사 – Joakim

관련 문제