Null object sending BluetoothDevice to Service

I have this intent:

    Intent serviceIntent = new Intent(getApplicationContext(), Servicio.class);
                        serviceIntent.putExtra(MainActivity.EXTRA_BT_DEVICE, btDevice);

but for some reason, in the service with this code:

    btDevice = (BluetoothDevice) params.getExtras().get(MainActivity.EXTRA_BT_DEVICE);//btDevice = getParcelableExtra(EXTRA_BT_DEVICE)

it says the intent is null but it isn't null on the activity


  • What is the output of params.hasExtra(EXTRA_BT_DEVICE) ?
This discussion has been closed.