Null object sending BluetoothDevice to Service

I have this intent:

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

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
Tagged:

Comments

  • What is the output of params.hasExtra(EXTRA_BT_DEVICE) ?
Sign In or Register to comment.