check if intent has extras

C++
Intent intent = getIntent();

if (intent.hasExtra("bookUrl")) {
    bookUrl = b.getString("bookUrl");
} else {
   // Do something else
}
Source

Also in C++: