[Handset] hookReceiver java class added
This commit is contained in:
parent
e0ea1bc98b
commit
48f0eea1e1
1 changed files with 31 additions and 0 deletions
31
src/org/linphone/HookReceiver.java
Normal file
31
src/org/linphone/HookReceiver.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package org.linphone;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
public class HookReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if(isOrderedBroadcast())
|
||||
abortBroadcast();
|
||||
Bundle extras = intent.getExtras();
|
||||
boolean b = extras.getBoolean("hookoff");
|
||||
if(b){
|
||||
//handset on
|
||||
Log.i(" ======>>>>>> HookReceiver - handset ON");
|
||||
LinphoneManager.getLc().enableSpeaker(false);
|
||||
LinphoneManager.getInstance().setHandsetMode(true);
|
||||
|
||||
|
||||
}else{
|
||||
//handset off
|
||||
Log.i(" ======>>>>>> HookReceiver - handset OFF");
|
||||
LinphoneManager.getLc().enableSpeaker(true);
|
||||
LinphoneManager.getInstance().setHandsetMode(false);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue