Skip to content

Instantly share code, notes, and snippets.

aws sns publish
--target-arn "ARN"
--message-structure json
--message '{"default": "{\"type\": \"incoming_call\", \"date\": \"TIMESTAMP\", \"body\": {BODY}}",
"GCM": "{\"data\": {\"type\": \"incoming_call\", \"date\": \"TIMESTAMP\", \"body\": {BODY}}, \"priority\": \"high\"}"}'
--message-attributes "{\"AWS.SNS.MOBILE.APNS.PRIORITY\":{\"DataType\":\"String\",\"StringValue\":\"10\"},
\"AWS.SNS.MOBILE.APNS.PUSH_TYPE\":{\"DataType\":\"String\",\"StringValue\":\"voip\"} }"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
android:id="@+id/audio_device_menu_bottom"
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="vertical"
android:background="#ffffff"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
mBottomSheetDialog = new BottomSheetDialog(getActivity());
View sheetView = getActivity().getLayoutInflater().inflate(R.layout.audio_device_bottom_sheet, null);
mSelectedBlueTooth = sheetView.findViewById(R.id.selected_bluetooth_img);
mSelectedSpeaker = sheetView.findViewById(R.id.selected_speaker_img);
mSelectedDefault = sheetView.findViewById(R.id.selected_handset_img);
mBlueToothItem = sheetView.findViewById(R.id.audio_bluetooth);
mBlueToothItem.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
final String action = intent.getAction();
/* Handle the SCO state update event. */
if (action.equals(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED)) {
final int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE,
AudioManager.SCO_AUDIO_STATE_ERROR);
switch (state) {
case AudioManager.SCO_AUDIO_STATE_CONNECTED:
private BluetoothProfile.ServiceListener mProfileListener = new BluetoothProfile.ServiceListener() {
public void onServiceConnected(final int profile, final BluetoothProfile proxy) {
if (profile == BluetoothProfile.HEADSET) {
/* Connected to BT headset profile proxy. */
mBluetoothHeadset = (BluetoothHeadset) proxy;
/* Update BT audio availability. */
}
}
public void onServiceDisconnected(final int profile) {
if (profile == BluetoothProfile.HEADSET) {
if (Intent.ACTION_HEADSET_PLUG.equals(action)) {
Log.d(TAG, "mReceiver: ACTION_HEADSET_PLUG");
if (intent.getIntExtra("state", 0) == 1) {
Log.i(TAG, "Headset plug in");
}
else {
Log.i(TAG, "Headset plug out");
}
}
private func bringupAudioDeviceSheet(availableAudioPorts:[AudioPortInfo]) {
let alertController = UIAlertController(title: nil,
message: nil,
preferredStyle: .actionSheet)
for audioPort in availableAudioPorts {
let action = UIAlertAction(title: audioPort.portName, style: .default) { (action) in
SoundManager.sharedInstance.setPreferredInput(audioPortDescription: audioPort.portDescription)
}
if audioPort.checked {
action.setValue(true, forKey: "checked")
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>XXYYZZ112233.com.YOUR_COMPANY.YOUR_PRODUCT</string>
</array>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>
<key>com.apple.security.cs.disable-library-validation</key><true/>
<key>com.apple.security.temporary-exception.apple-events</key><true/>