During a recent campaign stop in South Carolina, billionaire presidential candidate and hairpiece aficionado Donald Trump decided to share Senator Lindsey Graham’s personal cell phone number with the crowd (and all of televised America). This resulted in his phone being inundated by calls from across the country. So what’s Senator Graham (R-SC) to do with a number that may as well be scrawled across every truck stop bathroom in the nation under “For a good time call”? Well, first, he got himself a new phone. Then he teamed up with Independent Journal Review, a news and politics forum, to give his trusty old flip-phone the send-off it deserved — which apparently includes lots of fire, golf clubs, blenders, bokken and long falls.
Source: IJR (Twitter)
Need proof that Neil deGrasse Tyson has a knack for explaining complex astrophysical concepts in simple terms? You don’t have to spend the better part of an hour watching a Cosmos episode — in fact, a short work break will do the trick. The famed astrophysicist has posted a video explaining the basic history of the universe within 8 minutes, ranging from the Big Bang to humanity itself. The clip notes that many things we take for granted (such as gravity and the prevalence of matter) were decided in the earliest moments of the universe, and that our Solar System largely exists thanks to giant stars ejecting heavy elements. That sounds like a lot to take in, but don’t worry: this is quite accessible, and it’s a good primer on the nature of… well, everything.
Filed under: Science
Via: The Verge
Source: MinutePhysics (YouTube)
We have previously demonstrated how to use a web API from your Android app, and we have also discussed how to get and use location data in your Android app. In this tutorial, we will utilize both of these lessons, and show how you can track a device’s location using a remote web API. The remote web API we selected is the Thingspeak API.
For this article, we will develop an Android application that gets the device’s location information, and sends the latitude/longitude data to a ThingSpeak channel. We will then fetch the last location data from the ThingSpeak channel, and compute the distance from the last updated location to a location entered by the user. A simple (and obvious) use of this is parents who wish to track their children, or employers tracking employees. The ThingSpeak channel can also be viewed using a browser.
First thing you should do is to register for a ThingSpeak account. It is, at the time of writing, completely free. After registration, you will need to create a channel. You can have multiple channels, but each channel has a unique ID, and a special Channel write API_KEY, that can be used to write or read data to the channel. For a private channel, you can generate read API_KEYs, that can only read data from the channel.
While creating your channel, you might notice a Latitude and Longitude field. These are used for static devices, and are not suitable for our use case. ThingSpeak allows for the tracking of up to eight different fields, named field1 through field8. We add latitude as field1, and longitude as field2. You can access the ThingSpeak documentation online on their Support page
Our app layout displays the current device latitude and longitude. Beneath these is a button, enabling us begin and pause location tracking. Whenever the app receives a location update, the values of the TextViews are updated, and the new location data is immediately sent to the ThingSpeak channel. There are two EditTexts, into which the user can enter latitude and longitude values to compare against the device’s location. Clicking on the “Get Distance” button will fetch the last updated location from the thingspeak channel, and perform a Location.distanceTo() to compute the distance between both Locations.
Our activity_main.xml is a simple RelativeLayout.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> <TextView android:id="@+id/latitudeText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/latitude" android:textSize="20sp"/> <TextView android:id="@+id/latitudeUpdate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/latitudeText" android:paddingLeft="@dimen/activity_horizontal_margin" android:text="0.00" android:textSize="20sp"/> <TextView android:id="@+id/longitudeText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/latitudeText" android:text="@string/longitude" android:textSize="20sp"/> <TextView android:id="@+id/longitudeUpdate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/longitudeText" android:layout_below="@id/latitudeUpdate" android:paddingLeft="@dimen/activity_horizontal_margin" android:text="0.00" android:textSize="20sp"/> <Button android:id="@+id/locationController" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_below="@id/longitudeUpdate" android:text="@string/resume" android:onClick="toggleLocationUpdates" /> <EditText android:id="@+id/latitudeTarget" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/locationController" android:hint="@string/target_latitude"/> <EditText android:id="@+id/longitudeTarget" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/latitudeTarget" android:hint="@string/target_longitude"/> <Button android:id="@+id/notificationController" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/longitudeTarget" android:layout_centerHorizontal="true" android:text="@string/get_distance" android:onClick="compareLocation" /> <TextView android:id="@+id/distanceText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/notificationController" android:gravity="center"/> <ProgressBar android:id="@+id/progressBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/notificationController" android:layout_centerHorizontal="true" android:visibility="gone"/> </RelativeLayout>
Updating your channel
Recall our previous article on fetching location data? For this app, we are using the GPS_PROVIDER. If your application runs in the background (as a service), consider using the PASSIVE_PROVIDER, or use a longer refresh time.
In the code snippet below, when the “Begin Tracking” button is clicked, we request location updates from the GPS_PROVIDER every two minutes (2 * 60 * 1000). However, if the button reads “Pause Tracking”, we ask the LocationManager to stop sending updates.
public void toggleLocationUpdates(View view) if(!checkLocation()) return; Button button = (Button) view; if(button.getText().equals(getResources().getString(R.string.pause))) locationManager.removeUpdates(locationListener); button.setText(R.string.resume); else locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 2 * 60 * 1000, 10, locationListener); button.setText(R.string.pause);
This snippet is our implementation of the LocationListener interface. When we receive a new location update, the onLocationChanged() method is called, with the new Location information as the method arguments. On extracting the latitude and longitude values, we execute the AsyncTask that updates the thingspeak API.
private final LocationListener locationListener = new LocationListener() public void onLocationChanged(final Location location) longitude = location.getLongitude(); latitude = location.getLatitude(); runOnUiThread(new Runnable() @Override public void run() longitudeUpdate.setText(longitude + ""); latitudeUpdate.setText(latitude + ""); ); new UpdateThingspeakTask().execute(); ;
Android prevents developers from performing potentially long running tasks in the UI thread (the thread that controls the responsiveness of your application’s widgets). As such, we must perform network tasks in another thread, and the AsyncTask is a great class that handles all the thread complexity behind the scenes. Instructions in both onPreExecute() and onPostExecute() are run on the UI thread before and after the long running task respectively, while the long running task is placed in the doInBackground() method.
class UpdateThingspeakTask extends AsyncTask<Void, Void, String> private Exception exception; protected void onPreExecute() protected String doInBackground(Void... urls) try URL url = new URL(THINGSPEAK_UPDATE_URL + THINGSPEAK_API_KEY_STRING + "=" + THINGSPEAK_API_KEY + "&" + THINGSPEAK_FIELD1 + "=" + latitude + "&" + THINGSPEAK_FIELD2 + "=" + longitude); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); try BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); StringBuilder stringBuilder = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) stringBuilder.append(line).append("n"); bufferedReader.close(); return stringBuilder.toString(); finally urlConnection.disconnect(); catch(Exception e) Log.e("ERROR", e.getMessage(), e); return null; protected void onPostExecute(String response) // We completely ignore the response // Ideally we should confirm that our update was successful
Fetching channel data
There are many different ways data can be read from a ThingSpeak channel. This includes
- The entire channel feed
- Individual fields
- A specific update
- Updates within a given time frame and more
Consult the documentation to learn more.
We, however, are interested in retrieving the last update only. This is implemented using an AsyncTask.
In the onPreExecute() method, we fetch the latitude/longitude values, disable further editing of the fields, and display the ProgressBar.
In the onPostExecute() method, we parse the received to a JSONObject, fetch the returned latitude/longitude values, and finally compute the distance between both locations.
class FetchThingspeakTask extends AsyncTask<Void, Void, String> Location target; protected void onPreExecute() double latitude = Double.parseDouble(latitudeEdit.getText().toString()); double longitude = Double.parseDouble(longitudeEdit.getText().toString()); target = new Location(""); target.setLatitude(latitude); target.setLongitude(longitude); latitudeEdit.setEnabled(false); longitudeEdit.setEnabled(false); distanceText.setText(""); distanceText.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); protected String doInBackground(Void... urls) try URL url = new URL(THINGSPEAK_CHANNEL_URL + THINGSPEAK_CHANNEL_ID + THINGSPEAK_FEEDS_LAST + THINGSPEAK_API_KEY_STRING + "=" + THINGSPEAK_API_KEY + ""); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); try BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); StringBuilder stringBuilder = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) stringBuilder.append(line).append("n"); bufferedReader.close(); return stringBuilder.toString(); finally urlConnection.disconnect(); catch(Exception e) Log.e("ERROR", e.getMessage(), e); return null; protected void onPostExecute(String response) if(response == null) Toast.makeText(MainActivity.this, "There was an error", Toast.LENGTH_SHORT).show(); return; latitudeEdit.setEnabled(true); longitudeEdit.setEnabled(true); distanceText.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); try JSONObject channel = (JSONObject) new JSONTokener(response).nextValue(); double latitude = channel.getDouble(THINGSPEAK_FIELD1); double longitude = channel.getDouble(THINGSPEAK_FIELD2); Location location = new Location(""); location.setLatitude(latitude); location.setLongitude(longitude); float distance = location.distanceTo(target); distanceText.setText("The distance between both Locations is n" + distance + " meters"); Log.e(TAG, "distance == " + distance); catch (JSONException e) e.printStackTrace();
The complete source is available on Github, for use as you see fit. If building from scratch, you would need to request for both the INTERNET and LOCATION permissions by adding the following to your AndroidManifest
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.INTERNET" />
Using the GPS_PROVIDER is a battery hog, so if your app is going to run in the background, consider using the PASSIVE_PROVIDER to reduce battery usage.
The ThingSpeak API allows channel updates every 15 seconds, and fields can contain either numeric data or alphanumeric strings. There are tons of interesting public channels, including a hamster on Twitter. Have you used ThingSpeak or a similar service? What was your experience? What was/is your use case? Share in the comments below.
Android Developer Newsletter
Do you want to know more? Subscribe to our Android Developer Newsletter. Just type in your email address below to get all the top developer news, tips & links once a week in your inbox:
PS. No spam, ever. Your email address will only ever be used for Android Dev Weekly.
If you’ve been waiting to get your hands on a smartphone that can be dropped in water and would like to refrain from spending almost $700 on a Galaxy S6 Active, there might be a decent option for you over at T-Mobile. Just announced earlier today, the Kyocera Hydro WAVE is a brand new smartphone that’s making its way to both T-Mobile and MetroPCS.
The Hydro WAVE sports a 5.0-inch qHD LCD display, a 1.2GHz quad-core processor, 1GB of RAM, 8GB of on-board storage (expandable via microSD up to 32GB) and a 2300mAh battery. It also runs Android 5.1 Lollipop and ushers in Kyocera’s new “Core Home” software experience, which is an optional, simplified UI for those who prefer the interface of a feature phone.
The big story here is the device’s IPX5 and IPX7 certifications, which allow the device to withstand submersion in water up to 30 minutes at a time in up to 3.28 feet (1 meter). It also has Military Standard 810G certification for shock and drops, an IP5X dustproof rating, and can be operated when wet.
Want to get your hands on one? If you’re a T-Mobile customer, you can purchase the Kyocera Hydro WAVE from today for $149.99, though MetroPCS customers will have to wait until July 27th to pick one up. The device is also available for $189.99 through T-Mobile’s prepaid network.
Kyocera has been no stranger to producing durable and waterproof phones. Their Hydro line can be mostly found via prepaid carriers, with low retail pricing to boot. That being said, these phones aren’t meant to shine in the specs department.
Today we get word on a Kyocera Hydro update for T-Mobile and MetroPCS, the WAVE.
As expected, we have some robust durability specs: IP57 certification, for waterproofing (immersion for up to 30 minutes in 3.28 ft or 1 meter of water) and dust protection, and a military 810G rating for shock. The screen is also said to be impact-resistant, with reinforcement by the chassis.
Kyocera also say that the touchscreen still works when it’s wet. It’s great to hear they’ve thought this through.
The retail price of the WAVE is quoted at $150, so expect some lofty compromises:
- Display: 5″ IPS qHD (960 x 540 pixels) LCD
- SoC: Snapdragon 410 (quad-core, 1.2 GHz)
- RAM: 1 GB
- Storage: 8 GB on-board, with microSD expansion up to 32 GB
- Cameras: 5 MP rear and 2 MP front
- Battery: 2,300 mAh, non-removable
- OS: Android 5.1 Lollipop
There are a few notable software extras that Kyocera has included:
- MaxiMZR and Eco Mode – two energy-saving features that manage apps and overall power consumption.
- MagniFont – enlarges selected text to make it easier to read.
- Core Home – simplifies the UI
The Hydro WAVE will be available at T-Mobile starting July 22nd, followed by MetroPCS on July 27th. Does the WAVE match what you had in mind for a durable phone at the $150 price-point?
The post Kyocera Hydro WAVE splashes onto T-Mobile and MetroPCS appeared first on AndroidGuys.
Budget friendly phones have gained a ton of traction in the US in the last couple of years. More and more people are opting for prepaid plans as they are a great alternative to high-priced contracts. As a result, budget phones have gotten more attention from manufacturers, as they know customers still want a phone that can handle the day-to-day tasks without the price of a flagship.
Asus and AT&T have partnered to bring a no-compromise budget smartphone called the ZenFone 2. For $119.99, you will get a 5-inch 1280×720 IPS display with 294ppi pixel density, Gorilla Glass 3 to keep things scratch free, 4G LTE, 1GB RAM, 8GB of on-board storage with the option to add a Micro-SD card up to 64GB, and it also comes with a 8MP rear camera with HDR mode. In a comparison to a highly reviewed budget smartphone, the 2nd generation Moto G, all specs are the same with exception to the processor choice. The 2nd generation Moto G uses a Snapdragon 400 whereas the ZenFone 2E uses the dual-core Intel Atom processor. In regards to the price, the almost identically spec’d Moto G retails for 179.99, so if you’re trying to decide which phone is best, I think it is safe to say the Asus ZenFone 2E should be the phone to go with. Keep in mind that Motorola has a reputation for providing the best service when it comes to updates to the software.
|Model||ASUS ZenFone™ 2E|
|Operating system||Android 5.0 (Lollipop) with ZenUI|
|Display||5-inch IPS display with 1280×720 (HD) resolution and 294ppi pixel density
Corning® Gorilla Glass® 3 with anti-fingerprint coating
|PixelMaster Cameras||8MP front F/2.0 aperture, auto-focus, LED flash, 5-element lens
2MP rear, F/2.0 aperture
|Video recording||1080p HD video recording|
|Network standards||AT&T 4G LTE
FDD LTE 2/3/4/5/7/17/20
|Memory & Storage||1GB RAM
8GB eMMC storage
Micro SDXC slot (up to 64GB, sold separately)
|Connectors||3.5mm audio jack|
|Location sensors||GPS, A-GPS, GLONASS|
|Battery||2500mAh non-removable lithium-polymer|
|Colors||White and black covers included|
|Dimensions (H x W x D)||5.83″ x 2.81″ x 0.43″|
|MSRP||$119.99 with AT&T pre-paid GoPhone plan|
ASUS press release – If you click the source be aware of the press release automatically switching to the ASUS homepage.
The post AT&T adds the ASUS ZenFone 2E to the GoPhone line-up appeared first on AndroidGuys.
There’s no denying that the HTC One M9 is one of the more strikingly elegant smartphones currently on the market, but if it’s not quite premium enough for you, GoldGenie is offering a trio of 24K gold-plated variants of the handset with eye-watering price tags.
The M9 is available from the supplier of luxury customized gift in three different finishes — gold which weighs in at $2400, rose gold which will set you back $2500 and platinum which retails for $2600. But that’s not the total cost. Customers will also be required to pay shipping fees on top.
As you’d expect, all handsets from GoldGenie come with a lifetime warranty to cover any potential damage to their gold paintwork. They also come protected by HTC’s Total Armour Protection scheme.
Come comment on this article: GoldGenie launches its trio of 24K gold-plated HTC One M9’s
Defying a dropoff in sales of smartphones in the Chinese market, Huawei reported their smartphone sales for the first half of 2015 increased 39 percent. The performance was driven in large part by demand for high-end devices, which when combined with Huawei’s middle tier handsets, resulted in a 70 percent increase in shipments for those categories.
According to Huawei, the largest telecom equipment manufacturer in China, the company sold 48.2 million smartphones during the first half of the year. For reference, Apple sold 47.5 million iPhones just in the second quarter. Although Hauwei is huge in China, they still trail Apple, Samsung and Lenovo in terms of global smartphone sales.
Analysts have noted that the Chinese market has started to cool recently. For the first quarter of 2015, the market actually experienced a contraction which was the first decline since 2008. For the past five years, the Chinese market average 88.8 percent annual growth. However, IDC is projecting that growth rate will fall all the way to just 4.4 percent by 2019.
Huawei has slowly been positioning itself to survive the changes in its home market for smartphones. The company has introduced a smartwatch, it has been rolling out a global marketing campaign, and has focused on expanding in European markets, notably Spain and Italy.
Come comment on this article: Hauwei defies trend with smartphone sales growth of 39%
If you are slightly clumsy and drop your phone too often, or don’t want to worry about breaking your expensive handset due to your butter-fingers syndrome, there is a perfect solution for you – Kyocera’s Hydro Wave.
Launching on T-Mobile as well as MetroPCS, the Hydro WAVE features a 5-inch display, a 1.2GHz quad-core processor, 1GB of RAM and 8GB of expandable storage and 2,300 mAh battery. Running the latest Android 5.1 Lollipop, the rugged device comes with top of the line connectivity options including 4G LTE, Wi-Fi and Bluetooth 4.0.
The USP of the device is its drop-proof, impact-resistant and water-proof design. The Hydro Wave comes with IPX5 and IPX7 certification that lets it survive in one metre of water for up to 30 minutes. The touchscreen of the device is even operable under water. It also has Military Standard 810G and IP5X dust-proof certification to its kitty.
While T-Mobile customers can buy the Kyocera handset for $149.99 from today onwards, MetroPCS stores will start selling it on July 27.
Affordable Hydro WAVE Offers Large 5-Inch Display in a Waterproof, Drop-Proof, Impact-Resistant Design
SAN DIEGO–(BUSINESS WIRE)–Kyocera Communications Inc. today unveiled its newest waterproof 4G LTE Android smartphone – the Kyocera Hydro WAVE. The latest in Kyocera’s portfolio of durable, waterproof devices, the Hydro WAVE sports a large 5-inch display and a drop-proof, impact-resistant design. Suggested retail price is $149.99 before rebates or promotions. The phone goes on sale at participating T-Mobile locations on July 22, then launches at MetroPCS stores nationwide on July 27. Wireless providers will confirm their pricing and any additional availability details.
“Water damage and dropped phones regularly top the list of causes of smartphone failures. Hydro WAVE protects against those, while providing a worry-free experience for users.”
“The Hydro WAVE not only offers the display size and features of more expensive devices, but also gives users the peace of mind that comes with such a durable phone,” said Chuck Becher, vice president and general manager of sales and marketing at Kyocera Communications. “Water damage and dropped phones regularly top the list of causes of smartphone failures. Hydro WAVE protects against those, while providing a worry-free experience for users.”
Its waterproof design protects the Hydro WAVE against everyday hazards, like drops in a puddle or the toilet. With its IPX5 and IPX7 certifications, it will survive an unexpected shower or water immersion for up to 30 minutes in up to 3.28 feet (1 meter) of water. The phone’s touchscreen can even be operated when wet. Hydro WAVE also carries Military Standard 810G certification for shock and drops, and an IP5X dustproof rating. Hydro WAVE’s high-speed 4G LTE network technology is complemented by Wi-Fi calling for even more reliable and flexible connectivity.
The Hydro WAVE features the Android 5.1 “Lollipop” operating system and marks the debut of Kyocera’s “Core Home,” an optional, simplified user interface for those who prefer the familiarity of a feature phone. It comes ready with Google Mobile services including Google Play, Google Hangout, Gmail, and more. The phone also is equipped with a 5MP camera capable of 720p HD video capture at 30fps, a 3-axis accelerometer, Stereo Bluetooth (4.0 + LE/EDR) wireless technology support, as well as voice recognition and hearing-aid compatibility. It includes a Qualcomm Snapdragon™ 1.2GHz Quad-Core CPU, along with 8GB ROM/1GB RAM and a microSD™ memory card slot for up to 32GB of additional memory. Hydro WAVE has a long-lasting 2300mAh Lithium ion (Li-ion) non-removable battery and includes Kyocera’s Eco Mode and MaxiMZR applications for enhanced power management.
For more information about the Kyocera Hydro WAVE, visit http://www.kyoceramobile.com/hydro-wave or see it at a T-Mobile or MetroPCS retail store.
Come comment on this article: Kyocera brings rugged Hydro Wave to T-Mobile and MetroPCS
Those of you with new phones like the Samsung Galaxy S6 that lack a microSD card slot will be happy to learn an ongoing deal for a storage device from SanDisk. It looks just like a normal USB flash drive, but has a few tricks up its sleeve. It has a microSD card slot for storage, a battery, and acts as a WiFi hotspot.
All you have to do is press the WiFi button to turn it on and it will start broadcasting a WiFi single out to all devices around it. You then connect to it on your mobile device and transfer all the files you want to it using their app. You do not need an internet connection for it to work either.
It even allows you to stream content from it to your mobile device. Say you have a large movie on the USB stick you can connect to it and stream the movie to your phone without plugging anything in or transferring anything to your phones storage. Again, without an internet connection.
I have listed mobile devices so far, but it will work with computers as well. It can connect to them while they are still connected to the internet as well. Just keep the device in your pocket and transfer all you want without any wires.
If that wasn’t awesome enough the microSD card it comes with is 64GB which is plenty of additional storage space, but can be upgraded to a 128GB if you happen to have/buy one in the future.
Right now, the 64GB model is on sale at Amazon for only $49.99. The retail price is $295 which makes this 83% or $245.01 off! To sweeten the deal even more the 64GB is actually cheaper right now than the 32GB or the 16GB.
Come comment on this article: [Deal] SanDisk discounts 64GB flash drive with WiFi from $295 to only $50