Example usage for android.bluetooth BluetoothMapClient ACTION_MESSAGE_DELIVERED_SUCCESSFULLY

List of usage examples for android.bluetooth BluetoothMapClient ACTION_MESSAGE_DELIVERED_SUCCESSFULLY

Introduction

In this page you can find the example usage for android.bluetooth BluetoothMapClient ACTION_MESSAGE_DELIVERED_SUCCESSFULLY.

Prototype

String ACTION_MESSAGE_DELIVERED_SUCCESSFULLY

To view the source code for android.bluetooth BluetoothMapClient ACTION_MESSAGE_DELIVERED_SUCCESSFULLY.

Click Source Link

Usage

From source file:com.google.android.car.kitchensink.bluetooth.MapMceTestFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.sms_received, container, false);

    Button reply = (Button) v.findViewById(R.id.reply);
    Button checkMessages = (Button) v.findViewById(R.id.check_messages);
    mBluetoothDevice = (TextView) v.findViewById(R.id.bluetoothDevice);
    mOriginator = (EditText) v.findViewById(R.id.messageOriginator);
    mOriginatorDisplayName = (TextView) v.findViewById(R.id.messageOriginatorDisplayName);
    mSent = (CheckBox) v.findViewById(R.id.sent_checkbox);
    mDelivered = (CheckBox) v.findViewById(R.id.delivered_checkbox);
    mSendIntent = new Intent(BluetoothMapClient.ACTION_MESSAGE_SENT_SUCCESSFULLY);
    mDeliveryIntent = new Intent(BluetoothMapClient.ACTION_MESSAGE_DELIVERED_SUCCESSFULLY);
    mMessage = (TextView) v.findViewById(R.id.messageContent);
    mDevicePicker = (Button) v.findViewById(R.id.bluetooth_pick_device);
    mDeviceDisconnect = (Button) v.findViewById(R.id.bluetooth_disconnect_device);
    //TODO add manual entry option for phone number
    reply.setOnClickListener(new View.OnClickListener() {
        @Override//from   www . ja  v  a  2s .  c o  m
        public void onClick(View view) {
            sendMessage(new Uri[] { Uri.parse(mOriginator.getText().toString()) }, MESSAGE_TO_SEND);
        }
    });

    checkMessages.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            getMessages();
        }
    });

    // Pick a bluetooth device
    mDevicePicker.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            launchDevicePicker();
        }
    });
    mDeviceDisconnect.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            disconnectDevice(mBluetoothDevice.getText().toString());
        }
    });

    mTransmissionStatusReceiver = new NotificationReceiver();
    return v;
}

From source file:com.google.android.car.kitchensink.bluetooth.MapMceTestFragment.java

@Override
public void onResume() {
    super.onResume();

    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    mBluetoothAdapter.getProfileProxy(getContext(), new MapServiceListener(), BluetoothProfile.MAP_CLIENT);

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(BluetoothMapClient.ACTION_MESSAGE_SENT_SUCCESSFULLY);
    intentFilter.addAction(BluetoothMapClient.ACTION_MESSAGE_DELIVERED_SUCCESSFULLY);
    intentFilter.addAction(BluetoothMapClient.ACTION_MESSAGE_RECEIVED);
    intentFilter.addAction(BluetoothMapClient.ACTION_CONNECTION_STATE_CHANGED);
    getContext().registerReceiver(mTransmissionStatusReceiver, intentFilter);
}