0
일부 블루투스 장치가 연결되어있을 때 내 안드로이드 전화로 응용 프로그램을 시작하려면 어떻게해야합니까?블루투스 장치 연결시 응용 프로그램 시작
브로드 캐스트 리시버로이 작업을 수행하려고하는데 한 가지 문제가 있습니다 ... 내가 활동을 마칠 때 (브로드 캐스트 수신기가 등록되지 않아야 함) ... 연결을들을 수있는 방법이 없습니다. 장치 ...
응용 프로그램이 끝난 후이 브로드 캐스트 수신기를 살아있게 유지하는 방법은 무엇입니까?
감사
편집 :
public class AutostartReceiver extends BroadcastReceiver
{
/**
* @param context Context
* @param intent Intent
* @return void
*/
@Override
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
switch (action)
{
case BluetoothDevice.ACTION_ACL_CONNECTED:
Log.v("PAREK", "cnn");
break;
case BluetoothDevice.ACTION_ACL_DISCONNECTED:
Log.v("PAREK", "dnn");
break;
}
}
}
나는 또한 단지 매니페스트 초기화와 tryied
<receiver
android:name=".Model.Tools.AutostartReceiver">
<intent-filter>
<action android:name="android.bluetooth.BluetoothDevice.ACTION_ACL_CONNECTED" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECTED" />
</intent-filter>
</receiver>
EDIT2 :
이유는 무엇입니까? 응용 프로그램이 자동차의 핸즈프리에 연결되면 응용 프로그램이 시작되고 응용 프로그램이 연결 해제 된 후 5 분이 지나면 응용 프로그램이 "종료"됩니다.
내가 활동을 마무리하는 경우 그것은 작동하지 않습니다, 방송 수신기가 자동으로 수행 아무것도 ... 왜 IDK (하지만 여전히 작동 GPS 수신기) ... @Dillon 버튼 –
당신이 권한을 추가 한'< 사용 권한 android : name = "android.permission.BLUETOOTH"/>'및' '? –
또한 브로드 캐스트 리시버가 작동하지 않거나 스위치 명령문에서 케이스를 건드리지 않는다는 것입니까? –