'Android'에 해당되는 글 22건

  1. 2013.08.29 [Android] - 안드로이드 Notification, 상태바 알림 사용예제
  2. 2013.07.01 [Android] - 안드로이드 블루투스 헤드셋 브로드캐스트 리시버

[Android] - 안드로이드 Notification, 상태바 알림 사용예제

Android Java 2013. 8. 29. 17:30
반응형

private static Notification noti;

private static final int notiId = 1;


noti = new NotificationCompat.Builder(ncontext)

.setSmallIcon(R.drawable.btn_star)

.setContentTitle(title)

.setContentText(content)

.setTicker("알람이 동작되었습니다.")

.setContentIntent(pintent)

.setAutoCancel(false)

.build();


noti.flags |= Notification.FLAG_NO_CLEAR; // 지우기 버튼 눌렀을때 지워지지 않게

nm.notify(notiId, noti); // 알림 동작

nm.cancel(notiId); // 알림 제거

반응형
:

[Android] - 안드로이드 블루투스 헤드셋 브로드캐스트 리시버

Android Java 2013. 7. 1. 11:51
반응형

@Override

public void onReceive(Context context, Intent intent) 

{

String action = intent.getAction();

Log.i(TAG, " ================== " + action);

if(action.equals(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED))

{

int status = intent.getIntExtra(BluetoothHeadset.EXTRA_STATE, AudioManager.SCO_AUDIO_STATE_ERROR);

// status = 0 : Disconnected

// status = 1 : Connecting

// status = 2 : Connected

if(status == 0)

{

Log.e(TAG, " ================== 헤드셋 연결해제");

}else if(status == 1)

{

Log.e(TAG, " ================== 헤드셋 연결중");

}else if(status == 2)

{

Log.e(TAG, " ================== 헤드셋 연결됨");

}

}

}

반응형
: