Should I leave the bluetooth reflection hack in production code? Should I leave the bluetooth reflection hack in production code? android android

Should I leave the bluetooth reflection hack in production code?


Superb question. Basically you can use reflection all you want. Even i did something similar inorder to calculate the application launch times, got a method via reflection and its working like a charm from FroYo till Jelly Bean. The only word of caution you need to exercise is this,

  • Since it is not a public API, google can change it anytime without warning
  • If it changes, the system apps or HAL which uses it will be accordingly modified without any applications getting affected.

Where will you need to be careful?

Chances are the arguments of this method may get modified in the future.

So you will need to check for this with each new OS release so that your application does not break. Otherwise you need not worry about using this hack. Many applications use such hacks when things arent exposed with the API.