Created
November 6, 2015 11:52
-
-
Save vaibhav-jani/fa7d0631242d2d6fb319 to your computer and use it in GitHub Desktop.
Sticky StickBroadcast Intent demo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Intent batteryIntent = getActivity().getApplicationContext().registerReceiver(null, | |
| new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); | |
| try { | |
| int temperature = batteryIntent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, 0) / 10; | |
| showBetteryTemperature(temperature); | |
| } catch (Exception e) { | |
| e.printStackTrace(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment