Smartphone VR: Another 3D fad or the real deal?

This is the second in the three-part series looking at 3D imaging. In the first, we looked at why every time “3D” has failed to become totally mainstream. Today, 3D is back and trying to make a splash in mobile devices – this time in the form of “virtual reality.” Is VR — especially on smartphones — going to be a long-term success, or just another example of a 3D fad?

VR headsets like the Oculus Rift, HTC Vive, PlayStation VR and similar “tethered” products have made great strides in the last few years. So-called “mobile” VR headsets, like Samsung’s Gear VR and Google’s Daydream, have been even more successful (or at least more widespread). They’re basically head mounts for your smartphone with some optics thrown in, and lately it seems like everyone is making one. But will it stick?

Having just looked at the fanfare-and-failure cycles of 3D in general, should we really expect VR to really have staying power? Will it make a big splash and then fade just like its predecessors?

Wikipedia A Samsung VR conference in 2016

At heart, VR headsets are stereoscopic “3D” displays, with the all same potential problems and an added twist. It’s “virtual reality” because it lets you look around at, and interact with, this illusory three-dimensional world. That requires displaying the correct images to create a stereo effect, figuring out where the viewer is actually looking, and changing the image to match in real time. 

At the heart of it, VR headsets are stereoscopic 3D displays, with the same potential problems as every other example of the species.

If you move your head to look behind something, then that something had better move out of the way in your field of view, just as though it were really there. VR requires combining a convincing stereoscopic display with the sensors and graphics processing power needed to render and update your virtual view in a smooth, convincing manner. This is part of why I said that augmented reality is an even bigger challenge: if you’re going to, say, place an imaginary creature on a real tabletop, then not only do you have to render the creature correctly but keep it in the proper relationship to its real-world surroundings.

A dedicated, “tethered” VR headset can pull off all of its assigned tasks pretty well. Connecting it to a standalone computer, which could be anything from a barebones notebook to IBM’s Watson, means you can throw as much processing power as you can muster at problems. But the simple fact that it’s a product designed solely for the purpose of VR means that it has displays, optics, head-tracking systems, and so forth than could all be optimized to that goal. That’s not to say these products are going to be the perfect answer, but they’ve at least got a big leg up on the other option.

Editor’s Pick

That other option is “mobile” VR, which is typically a plastic mount with straps to go over your head and lenses over your eyes, and you supply the rest— namely a smartphone, which provides the displays, processing, and position sensing needed to create a virtual world. This is, in my not-so-humble opinion, a remarkably bad idea.

That “s” on “displays” wasn’t a typo. Yes, your phone only has the one display, but here it’s forced to play the role of two. Left-eye and right-eye images have to be shown simultaneously, and it’s up to the optics in the headset to deliver those correctly to the eyes. That means only half the pixels on the screen are available for each image, which leads to an aspect ratio and resolution charitably described as “less than optimal.”

A Galaxy S8 features a 5.8″ 2960 x 1440 OLED screen at 570 PPI. It’s a really nice smartphone display in anyone’s book, but close to a 2:1 aspect ratio. Splitting it in two in a VR headset means each eye gets an almost perfectly square display to use. That’s not good when we’d really like to have a wide field of view. The human eye uses something roughly equivalent to a 5:3 aspect ratio (of course, it’s also not a nice clean rectangle, but rather a sort of fuzzy oval).

There are two ways to fix this. You could use the full area of each half, displaying pre-distorted image on the square space and relying on the optics to stretch the image to the desired wider area— the same sort of trick used in anamorphic movies. However, If the distortion introduced into the image isn’t exactly what the optics were designed to “undo,” you’ve got problems. The other option is to just not use the full height of the display. If, on the S8, we have a 1440 x 1440 space for each image, but we want, say, a 16:9 view, we could just center a 1440 x 810 image in that space and it would be good to go, albeit at well under half the phone’s full resolution.

We could just demand a higher resolution in our phone screens. “But Bob,” I hear you protest, “didn’t you just tell us a few weeks ago that packing more pixels onto a phone was a bad idea?” Yes, I did. That article also generated some comments which took me to task for ignoring the needs of VR. But that was my point: smartphone display choices should ignore VR, at least as a top priority.

Smartphone display choices should ignore VR, at least as a top priority

Phone-based VR headsets represent the entry level in the VR market. They suffer from too many compromises already to be the choice for serious VR users, and paying for the extreme levels of screen resolution needed to address just that one issue makes no sense. As good as they are, smartphone graphics processing and position/orientation sensors just aren’t up the task of matching what you can do with a dedicated headset and tracking hardware.

Again, consider the Galaxy S8. It’s got an MSRP of more than $700—over $200 higher than Samsung’s own Odyssey VR/MR headset, which features dual 1440 x 1600 OLED displays coupled with a full array of cameras, motion and position sensors, integrated headphones, and adjustments for interpupillary distance. Putting a higher resolution display in a phone just for VR is like paying to put a Ferrari engine in a Toyota Prius. Sure, you’d get a lot more power, but the platform just isn’t meant to do what you want. You’re better off just buying the product meant for that use in the first place.

Graphics processing burden goes up literally geometrically with increased resolution, which isn’t the best idea for a battery-operated device.

We could even put a 4K display into a phone, and get a great resolution for each eye. The graphics processing burden goes up geometrically with increased resolution. Even if you build the added power into the processor, it just isn’t the best idea for a battery-powered device. Phone-based VR is best for what it was supposed to be: a quick and relatively economical means of introducing VR into the consumer market. But let’s not make the mistake of thinking it’s the right answer for the serious VR fanatic.

It’s not like dedicated VR headsets are perfect either. They still suffer from all of the other problems we’ve described earlier with stereoscopic displays, with the additional concern that motion tracking and its resulting view is never going to quite match what we see in real life. VR is getting a lot of attention in education circles, to name one interested market, but how long will that love affair last if kids get severe eye fatigue from using it?

24th Air Force

There’s a way around even that concern, though. All we need is a display that can produce a real three-dimensional image, one that actually has the appearance of solid objects occupying space, and without any glasses, headsets, head tracking, or any of those burdens. We’ve even already seen examples of this; surely everyone by now has seen a hologram. You’ve probably even got a few in your wallet, on your credit cards.

So when can we replace our old-fashioned flat displays, and free us from all this stereoscopic nonsense?Stay tuned.

Charles Sykes, Anti-Trump Conservative, Looks for Common Ground with the Left

Some conservatives are just as horrified as progressives.

Charles J. Sykes is among the more reasonable conservative voices in America now. Formerly a popular conservative talk radio host in Wisconsin, he once specialized in the sort of invective that drives ratings and barroom rants: The Census Bureau was a “bully”; Bill Clinton’s Justice Department was not unlike the Nazis; and so on. In the words of Milwaukee Magazine, he lived in “a Chicken Little reality where the sky is always falling and every public figure is forever running for cover.”

Then came Trump. During the 2016 campaign, Sykes broke ranks with Republicans over the candidacy of the oft-bankrupted real estate mogul. Sykes wrote a book titled How the Right Lost Its Mind. He became a regular contributor to the New York Times and a cogent critic of Trumpism. 

When I spotted Sykes at the Miami Book Fair, I had to ask him a question many people are asking: Can the left and right unite to get rid of Trump?

Here’s our conversation, edited for length.

Jefferson Morley: The country is in an emergency situation with Trump, and I think every possible solution should be considered, even things that haven’t been tried before, like the left working with the right. What could the left learn from the right at this moment when we have an incompetent, ignorant, impulsive, deceptive president?

Charles J. Sykes: First of all, I agree with every way you just described him, so let’s start with that. We have some commonality. If there is a Venn diagram between left and right, there’s not a lot of overlap these days, but there is some overlap, and that overlap is crucial on things like the truth ought to matter. Facts ought to matter. Rule of law ought to matter. Let’s find that common ground.

I find it interesting that people on the left are now suddenly very interested in the whole idea of checks and balances, and that’s OK because this is now an emergency, so let’s talk about it.

People on the right have to come to grips with, have we become a post-intellectual, post-knowledge movement? I think that’s important.

The one suggestion I would make [to the left], no political conversation can begin by people saying, “Will you confess now that you are a bigot and you’ve always been a bigot?”

Also recognize that there are conservatives who are as horrified, if not more horrified than you are, by what’s happened.

JM: What was the moment for you in the last few years when you realized what was coming? Was there an ‘aha’ moment?

CJS: No, there wasn’t one moment. It was this long, soul-crushing slog where I kept thinking, “This can’t happen. This won’t happen,” and then the growing recognition that the conservative movement was much more broken than I had thought. I thought I understood what [the movement] was about. I thought I understood who we were. And then I started to realize, this can’t be happening, if I was right.

There were two phases of this, both of which had their own soul-crushing qualities. The first was Trump’s rise to the nomination over other much more acceptable candidates, and the way the Republican electorate was voting for this man who was so manifestly unfit, so obviously a con man.

It wasn’t that the information was not available. And this was helped by the capitulation of much of the conservative media. To watch Fox News, Rush Limbaugh and others play this disingenuous, sick game of enabling him, I don’t know what game they were playing, but it had disastrous consequences.

The second phase, which was just as disillusioning, was watching all the people who… understood who Trump was—and in Wisconsin we voted against him overwhelmingly—fall in line behind him, one by one, because it was a binary choice, tribal politics. No matter how awful or terrible he was, no matter how many women he sexually assaulted, no matter how many disabled reporters he mocked, at least he wasn’t as hateful as Hillary Clinton.

I don’t think I was naïve about how partisan we’ve become, but the power of that tribalism was really on display there.

JM: You talk about being surprised. I think people on the left would say there’s a straight line from George W. Bush to Donald Trump, and that’s what set the stage for this. So you can’t exempt yourself from blame.

CJS: I don’t. I went back and I said, OK, I had been wrong about some things that I obviously did not fully understand, and I may have participated in myself. As you go back, you start to realize, wow, here are some warning signs I should have seen…

But there is a discontinuity between the party that used to listen to William F. Buckley and now listens to Sean Hannity; that used to read Edmund Burke and now reads Ann Coulter. So some things are not a straight line.

JM: Did you have a favorite among the Republican candidates?

CJS: I expected all along I was going to support Marco Rubio or someone like Marco Rubio. But he didn’t even last long enough to get to Wisconsin.

JM: Now we live in a social media world. We have the Facebook behemoth. Can we ever get back to having credible sources of information that are not immediately impugned and sidelined because of people’s preconceived notions?

CJS: That is an urgent question. That may be the most urgent question. You ask, was there an ‘aha’ moment for me? I think it was sometime in the middle of 2016 when I realized that I was no longer able to push back against fake news. So with people I had known for 20 years, I could not penetrate this alternative reality silo. They were immune. Nothing outside that bubble was credible to them. That was the ‘oh shit’ moment: where they had succeeded in delegitimizing everything on the outside. I don’t know how we put that back together.

JM: Is Robert Mueller our savior? How do you think about the Russia investigation?

CJS: It is immensely important. This is one of the most disillusioning parts of what’s happening: the failure on the part of conservatives to recognize that this is a fundamental issue of our democracy, if we had the Russians trying to undermine our democracy, this is very big and deep.

Having grown up in the era of Ronald Reagan to hear Republicans say, “It’s not that bad.”… I had a caller on the CSPAN show I just did who was defending Vladimir Putin, saying, “Putin stands up for his people just like Donald Trump.”

Obviously, this is a serious investigation. Don’t expect the Trump base to be moved because the battlefield has been prepped already: “this is biased, this is a witch hunt.” I actually believe if we had this media environment in the 1970s, Richard Nixon would have survived Watergate. I’m not kidding. Imagine if he had a Hannity and a Breitbart News and a Fox News.

On the other hand, I think that this is like turning over a rock. You are going to find so many things besides just the Russian collusion. We say that Donald Trump is a con man and a fraud, but that’s the way he’s done business for years. Now suddenly you have a guy [Mueller] who is going to get everything.

… I think if Trump tries to fire Mueller, I think you will have a full-fledged constitutional crisis.

JM: I feel like that’s inevitable: He will fire Mueller.

CJS: I think that anything that is conceivable, is perhaps likely. So, going back to your original question, that’s when you have to have Democrats and principled Republicans voting together. That’s when you are going to need conservative Republicans to say we’re going to draw the line.

It has already begun to a certain extent. Don’t underestimate the significance of John McCain, Bob Corker, Jeff Flake, and to a lesser extent Ben Sasse. They’re not running for reelection, so that’s a downside. The upside is that they speak for a lot of Republicans who are not willing to speak out. So there’s a residual potential there—unless you scare them off.

JM: So if you’re a congressman from Wisconsin and somebody says here’s an article of impeachment, are you ready to vote for that?

CJS: Now? No, it’s premature. This is one of the rare moments where I think Nancy Pelosi is the real voice of political savvy. She understands: Keep your powder dry. Don’t burn it all until the real stuff comes down. To talk about impeachment at this point, all it does is reinforce the instinct to circle the wagons.

You know more stuff is coming. Wait until you get it. Don’t cry wolf.

JM: Do you think Trump will survive his term?

CJS: I assume he will, yes. But the issue of the women [he groped or assaulted] is going to come back…. You have this massive cultural shift and it’s inevitable that his accusers are going to get their moment. You have this contrast between all of these other men whose careers have been annihilated. And here you have the president of the United States who has never apologized, who has paid no price for this whatsoever. Republicans are going to have to answer: Do you believe these women or do you not believe these women? That is coming.

 

 

Elemental Evil: Sessions 7

In the previous session the group basically finished the shortened Lost Mines of Phandelver adventure that I used to get them to level 3. In this session I handed out some treasure, and then played the transition to the main adventure, Princes of the Apocalypse. PotA by itself has a relatively weak story hook, but I had added several pointers to the Elemental Evil cults, especially the air cult, in the pre-adventure. So now telling them about the missing delegation was just one additional hook, which I used to also open up the option of going after the water cult. The general idea is to give players some options, playing PotA neither completely linear, nor completely sandbox.

So the players arrived at Red Larch and collected some information. They already knew about the tower of the air cult, but now they could see its location and find out that the locals thought it was just a hunting lodge for young knights from Waterdeep who liked aerial mounts. From the Order of the Gauntlet contact they got the information that a dwarven history book like the ones transported by the missing delegation had been seen in Womford. And a shephard in the tavern gave them the information that he had seen fresh graves south of Sumber Hills.

The whole role-playing from Phandalin to Red Larch took quite some time, but in the end the group decided to head towards the fresh graves and check them out, and to go towards the air cult tower from there. In the graves they found two dead members of the Mirabar delegation, as well as two different cultists, one of which they could recognize as an air cultist. While wondering who had buried them and closing the graves again, they were attacked by air cultists on giant vultures.

The encounter as written in the book wasn’t dramatic enough for my taste, so I had added a fourth air cultist as well as some helpful Aarakocra. But as the giant vultures by themselves were already rather strong, this made the fight rather tough, with several people having to made death saving throws before being healed by their friends. But in the end all went well. Their new Aarakocra allies explained to them that they could approach Feathergale Spire either from the top, but there was a drawbridge, or from the bottom through Sighing Valley. The group preferred the stealthy approach to knocking at the front door, and so I know what to prepare for the next session.

I’m shocked, SHOCKED, that racism is going on here!

When viewed from over here in Europe, American politics sometimes appear a bit weird. Last week it was weirder than usual. President Trump flip-flopped on his condemnation of white supremacists and racists, and there was a huge outcry about how he finally failed to take a strong verbal stand against racism. That left me very much confused! I had been under the impression that as a candidate Trump had run on a platform of pretty open racism and hate of foreigners, especially Mexicans and Muslims. I had been under the impression that a large part of the American electorate, somewhere between 30% and 50%, believed that foreigners were to be blamed for many American problems, and that an anti-foreigner “America first” policy would improve things. In short, I thought that once you stripped off the veneer of political correctness, the policies of xenophobia and racism were pretty much American mainstream. So how come everybody is so outraged if a president says what we all know that he is thinking?

What is so weird about political correctness is that people are okay with *actions* that directly target a specific race or religion, like building a wall towards Mexico, or a Muslim travel ban. But *speech* which contains racial or religious or gender discrimination is unacceptable? I can’t help but wonder whether it wouldn’t be a lot saner to do it the other way around: Have an open discussion about the fears and prejudices people have towards other races, religions, genders, or sexual orientations, but refrain from actually persecuting people for having a different race, religion, or sexual orientation. There is strong scientific evidence that a certain degree of xenophobia is something hard-wired into the parts of our brains from an earlier evolutionary period, and overcoming xenophobia means teaching the newer parts of the brain to override those outdated instincts. Prohibiting people from talking about those instinctive feelings isn’t really helpful in that respect, because it doesn’t make those feelings go away.

Masters and Servants

If you watch a film or TV series like Downton Abbey, you can learn about how the class structure of society worked a century ago. Many of those concepts of hereditary masters and servants are now completely outdated. But while class borders have become a lot more flexible today, classes still do exist. In today’s economy there are still masters, who are the customers paying for a service, and servants, who then get money for providing those services. Of course the guy who is a servant all day, for example an Uber driver, can come home and become the master by ordering a pizza delivered. But the rich are more likely to receive services, and the poor are more likely to provide those services; we aren’t really much more equal than back in the days of Downton Abbey.

This class divide has also reached games. If you can afford to buy $60 games or spend money in Free2Play games, you get services provided to you. If you play those Free2Play games for free, you end up being the content for other players. It is as if you were paid for providing a service as opponent for another player, only that you don’t get paid in cash but in access to the game.

I don’t like being a servant to a game company. Game companies, like most other companies, treat their customers like royalty, and their employees like garbage. So I don’t want to work for the game company, be the content, provide a service as a cheap replacement of an artificial intelligence. In particular I hate games where even if you pay money, you never can escape from that role as servant, because you always are content for other players.

I just can’t play the new Magic Arena, because it only has a PvP mode. Not only don’t I like serving as content for other players. I also don’t like the content that other players provide to me: Playing against random humans means total unpredictability, you can end up against a complete pushover or the guy who spent hundreds of dollars and hours on the game and is a complete pro. On the one side I feel bad if I play against a human and have to quit early because real life intervenes (which makes the game rather unsuitable for mobile platforms), but on the other side I hate it when my opponent quits early. I much prefer playing against an AI, where there is no social contract, and my opponent plays in a more predictable manner. Previous electronic versions of Magic the Gathering have proven that an AI can be created that plays the game reasonably well. So making a version of Magic without AI to me feels like simple exploitation of players as content, and I’m not willing to be exploited like that.

Will Python replaCe JaVa ?

will python replace java

Is Java Dying? of course not but Python growing in popularity day by day. Each has its own strengths and weaknesses.

According to IT programming trends, Java is more popular than any other programming language in terms of number of jobs, number of existing Java developers, and overall usage statics in IT. According to the latest usage statistics posted on a popular technology survey site, Java is being used by 3.0% websites as a server-side programming language, whereas only 0.2% of websites use Python. However, all the recent reports have highlighted that the usage and popularity of Python is growing drastically compared to Java, where usage is coming down year on year.
At myTectra, we have been monitoring the trend of Python and Java since 2013 based on the number of Jobs posted in Naurki for the Bangalore region since 2013. In the below table, we can see that Java requirements are coming down year over year, whereas Python requirement has grown from 200 in 2014 to 6500+ in 2017.

Following job posting statistics from Indeed shows Python is the only programming language consistently growing, compared to Java.

job posting in IT for proramming

Difference between Java and Python

There are three main language characteristics that make programmers more productive with Python than with Java.
In Java, all variable names (along with their types) must be explicitly declared. Attempting to assign an object of the wrong type to a variable name triggers a type exception.That’s what it means to say that Java is a statically typed language.
Java container objects (e.g. Vector and ArrayList) hold objects of the generic type Object, but cannot hold primitives such as int. To store an int in a Vector, you must first convert the int to an Integer. When you retrieve an object from a container, it doesn’t remember its type, and must be explicitly cast to the desired type.

In Python, you never declare anything. An assignment statement binds a name to an object, and the object can be of any type. If a name is assigned to an object of one type, it may later be assigned to an object of a different type. That’s what it means to say that Python is a dynamically typed language.
Python container objects (e.g. lists and dictionaries) can hold objects of any type, including numbers and lists. When you retrieve an object from a container, it remembers its type, so no casting is required.

Java is a verbose containing more words than are necessary but Python is concise expressing much in fewer words. Java is not compact but Python is a compact language.

Python  is powerful, flexible, open source language that is easy to learn, easy to use, and has powerful libraries for data manipulation and analysis. Its simple syntax is very accessible to programming novices, and will look familiar to anyone with experience in Matlab, C/C++, Java, or Visual Basic. Python has a unique combination of being both a capable general-purpose programming language as well as being easy to use for analytical and quantitative computing.

Python become a language of choice for all the current trending Technologies in IT. If the current trends continues Python will become the most sought after language and overtake the number of jobs requirement in next 2-3 years.

Want to Learn Programming?

Group Known for Stalking and Harassing Climate Advocates Has Been Hired by EPA to Run Media War Room

Definers Public Affairs, a Republican-aligned research group, has been handed a $120,000 contract to help the EPA shape its media coverage.

A Republican-aligned research group with links to a campaign to stalk and intimidate environmental groups, journalists and campaigners has been handed a $120,000 contract to help the EPA shape its media coverage.

Virginia-based Definers Public Affairs was given the 12-month “no bid” contract to provide “news analysis and brief service” to the EPA, as reported by Mother Jones.

Definers is the corporate arm of America Rising LLC, America Rising PAC and its opposition research and tracking service, America Rising Squared—known as AR2.

Republican Activists

Definers Public Affairs was founded and launched in 2015 by America Rising founders Matt Rhoades and Joe Pounder.

Pounder is a Republican strategist and former research director for the Republican National Committee and worked on Marco Rubio’s failed 2016 nomination campaign. Rhoades was Mitt Romney’s campaign manager in 2012.

Green Attack Plan 

America Rising ran a concerted campaign to attack environmentalists and targeted individuals such as climate campaigner Bill McKibben, who was followed and filmed by the group’s trackers. 

Others targeted with attack tactics and adverts include billionaire philanthropist and environmentalist Tom Steyer and New Yorker journalist Jane Mayer, whose work has uncovered the influences of petrochemical billionaires and Republican donors Charles and David Koch.

Brian Rogers, an executive director at AR2 and a senior vice president at Definers, said his campaign would “hold Steyer and the Environmentalist Left accountable for their epic hypocrisy and extreme positions which threaten America’s future prosperity.”

Speaking about the accusations leveled at him, Steyer said: “They have to know they’re lying. It’s completely dishonest, unethical, and pitiful. And it’s creepy.”

America Rising attempted to discredit Mayer by alleging a distant relative that worked for Lehmann Brothers once did business with Nazi Germany—an accusation that was shown to be without any evidence.

One of the group’s earliest targets was 350.org founder McKibben, who wrote about his experience in the New York Times.  Describing the photos and videos taken of him, McKibben wrote:

“In one series, my groceries are being packed into plastic bags, as I’d forgotten to bring cloth ones. In other shots, I am getting in and out of … cars. There are video snippets of me giving talks, or standing on the street. Sometimes I see the cameraman, sometimes I don’t. The images are often posted to Twitter, reminders that I’m being watched.”

America Rising also sent an operative to Texas Tech University to request copies of everything in the 54 boxes that make up an archive of McKibben’s papers. This, said McKibben, “resulted in all kinds of odd things appearing on right-wing corners of the web.”

Global War Room

An EPA spokesperson told Mother Jones the Definers contract was “for media monitoring/newsclip compilation.”

According to Mother Jones, the contract would include EPA using the Definers War Room console that helps clients track media coverage and the output of opponents.

In November 2017, it was announced that Definers had joined law firm Denton’s to launch a global research firm called 3D Global Affairs.

Among the services offered at 3D Global Affairs would be “governmental relations and lobbying support to shape the environment” and “communications and rapid response professionals to direct  the narrative.”

 

Related Stories

  • How the Right-Wing Media Totally Distorted Positive News on Climate Change
  • Scientists Have Just Beaten Down the Best Climate Denial Argument
  • Wall of Shame: Top 10 Climate Deniers in the Trump Administration

Android WiFi: Android – LeaVe my baThRoom at-least !

android wifi


WiFi is a technology for wireless local area networking with devices based on the IEEE 802.11 standards. Devices that can use Wi-Fi technology include personal computers, video-game consoles, smartphones, digital cameras, tablet computers, digital audio players and modern printers. Wi-Fi compatible devices can connect to the Internet via a WLAN and a wireless access point. Such an access point (or hotspot) has a range of about 20 meters (66 feet) indoors and a greater range outdoors. Hotspot coverage can be as small as a single room with walls that block radio waves, or as large as many square kilometers achieved by using multiple overlapping access points.

Android allows applications to access to view the access the state of the wireless connections at very low level. Android provides WiFi API through which applications can communicate with the lower-level wireless stack that provides WiFi network access. Almost all information from the device supplicant is available, including the connected network’s link speed, IP address, negotiation state, and more, plus information about other networks that are available. Some other API features include the ability to scan, add, save, terminate and initiate WiFi connections.

WifiManager is the primary API for managing all aspects of WiFi connectivity. Get an instance of this class by calling Context.getSystemService(Context.WIFI_SERVICE). It’s Syntax is given below:-

WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);


WifiManager class provides different methods to control WiFi activities:-

  • int addNetwork(WifiConfiguration config): Add a new network description to the set of configured networks.
  • WifiManager.MulticastLock createMulticastLock(String tag): Create a new MulticastLock
  • WifiManager.WifiLock createWifiLock(String tag): This method creates a new WifiLock.
  • boolean disconnect(): This method disassociate from the currently active access point.
  • boolean enableNetwork(int netId, boolean disableOthers): This method allow a previously configured network to be associated with.
  • int getWifiState(): This method gets the Wi-Fi enabled state
  • boolean isWifiEnabled(): This method return whether Wi-Fi is enabled or disabled.
  • boolean setWifiEnabled(boolean enabled): This method enable or disable Wi-Fi.
  • int updateNetwork(WifiConfiguration config): This method update the network description of an existing configured network.
  • boolean disableNetwork (int netId): Disable a configured network.

In order to scan a list of wireless networks, you also need to register your BroadcastReceiver. It can be registered using registerReceiver method with argument of your receiver class object. Its syntax is given below −

class WifiScanReceiver extends BroadcastReceiver {

   public void onReceive(Context c, Intent intent) {
   }
}
WifiScanReceiver wifiReciever = new WifiScanReceiver();
registerReceiver(wifiReciever, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));

The wifi scan can be start by calling the startScan method of the WifiManager class. This method returns a list of ScanResult objects. You can access any object by calling the get method of list. Its syntax is given below :-


List wifiScanList = mainWifiObj.getScanResults();

String data = wifiScanList.get(0).toString();

Example

Let’s see the simple example of wifi to enable and disable the wifi service.
To run this example you need actual Android device.
  • You will use Android studio to create an Android application under a package net.suven.android.androidwifi.
  • Modify src/MainActivity.java file to add necessary code.
  • Modify the res/layout/activity_main to add respective XML components.
  • Modify the AndroidManifest.xml to add the necessary permissions
  • Run the application and choose a running android device and install the application on it and verify the results.
Following is the content of src/MainActivity.java

package net.suven.android.androidwifi;

import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;


public class MainActivity extends Activity {
Button enableButton,disableButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

enableButton=(Button)findViewById(R.id.button);
disableButton=(Button)findViewById(R.id.button1);

enableButton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
WifiManager wifi = (WifiManager)getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(true);
Toast.makeText(getBaseContext(), "WiFI Enabled",
Toast.LENGTH_LONG).show();

}
});

disableButton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
WifiManager wifi = (WifiManager)getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(false);
Toast.makeText(getBaseContext(), "WiFI Disabled",
Toast.LENGTH_LONG).show();
}
});
}
}
Following is the content of activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<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"

tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:textSize="30dp"
android:text="ANDROID WIFI"
android:layout_above="@+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="11dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SCTPL"
android:id="@+id/textView2"
android:textSize="35dp"
android:textColor="#ff16ff01"
android:layout_above="@+id/imageView"
android:layout_centerHorizontal="true" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/suvenlogo"
android:layout_centerVertical="true"
android:layout_alignEnd="@+id/textView" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enable WiFi"
android:id="@+id/button"
android:layout_alignParentBottom="true"
android:layout_toStartOf="@+id/textView2"
android:layout_marginEnd="14dp"
android:layout_marginBottom="56dp" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="76dp"
android:text="Disable WiFI"
android:layout_alignBaseline="@+id/button"
android:layout_alignBottom="@+id/button"
android:layout_alignParentEnd="true"
android:layout_marginEnd="20dp" />

</RelativeLayout>
Following is the content of AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.suven.android.androidwifi">
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Following is the output of Application

android wifi enabled

android wifi disabled
Click here to download Source Code and APK

 Learn Android Programming?


BlackBerry ditching Priv updates is a frustrating missed opportunity

BlackBerry’s track history in the enterprise game and the marketing material plastered all over its website would lead anyone to believe that it’s one of the few smartphone companies actually taking the security issue seriously. So it was a little surprising to hear that BlackBerry is cancelling its smaller updates for the Priv, and so soon after declaring that it wouldn’t be providing a Nougat update to the handset either. It’s a disappointing situation for fans of the Priv, and even more disconcerting for customers who rely on BlackBerry to protect their sensitive information.

Now, I’m fully aware that providing long running updates for aging handsets that aren’t selling anymore is an expensive and often frustrating endeavor for OEMs. However, BlackBerry is missing a trick by not positioning itself as the major manufacturer with security at its forefront, by going a step further than the minimum two years of patches that almost every OEM promises.

BlackBerry Indeed, BlackBerry, indeed…

The case for long-running security updates cannot be understated these days. Although there are plenty of reactionary scare stories about various vulnerabilities, the fact that our mobile devices are increasingly used to store sensitive banking information, make mobile payments, and secure our biometric data makes patching exploits regularly more important than three or four years ago. Not forgetting BlackBerry’s historic audience of business users looking for additional security and encryption for sensitive emails, contacts, documents, and the like.

Between biometric storage, online banking, and payments, the case for long running security updates cannot be understated.

Ditching this commitment to Priv owners is poor form. But just as importantly, this decision leaves customers uncertain about the state of similar update promises made for the KEYone, Motion, and DTEK series. Can we take BlackBerry more seriously on security matters than any other OEM anymore?

The crux of the matter, for me, is that this announcement isn’t just disappointing for Priv owners, it undermines the whole concept and potential of BlackBerry as the go-to brand for serious Android security. That’s a particularly disappointing revelation for the enterprise market, where companies need an OEM they can rely on to keep a fleet of handsets secure in the long term.

No one else, bar perhaps Google, has been tackling this issue seriously enough, and certainly no major brand has gone as far as BlackBerry in the amount of marketing emphasis placed on security. The company’s Document Locker and Privacy Shade are great features for the privacy conscious, as are the company’s Hub+ apps and its broader Secure Platform. However, without also ensuring that the operating system is kept up to date and secure too, the hard work on the software front is undermined.

BlackBerry could have owned the privacy and security niche in the Android space, but that trust fades with the Priv.

I should make clear that BlackBerry isn’t completely ditching all its obligations with the Priv. The company states that it would “engage [its] partners as needed to develop and deliver necessary patches” should any critical problems arise, and that it would “fulfill all warranty obligations” regarding the handset. Even so, what counts as critical or only a moderate security issue, and how high up the priority queue the Priv would be for a fix are concerning unanswered questions.

Based on its well-earned historic reputation, BlackBerry could have owned the privacy and security niche in the Android space. A solution very much needed given the price comparison with Apple’s iPhones. Instead, BlackBerry may find that its potential customers flock to Apple for its ability to provide updates over many years, or to Samsung for the promises made by Knox.

BlackBerry’s compromise on this issue is the introduction of a “trade-up” program for Priv owners and those holding onto BB10 and BBOS devices. While all the details aren’t out in the open yet, the gist is that existing customers will be able to purchase a newer KEYOne or Motion handset with some sort of discount. Perhaps that will tide some customers over, but as I already mentioned, what happens if/when BlackBerry gives up on updates to these handsets within the next two years also?

No matter which way you slice it, BlackBerry failing to properly update the Priv to Nougat, not even Oreo, and refusing to extend important security updates beyond the “standard” 2 years promised by everyone else is an undeniable sign that the company isn’t willing to go the distance with security. That’s more than a little disappointing.

Huawei confirms its phones will be sold by US carriers in 2018, starting with Mate 10

  • Huawei exec Richard Yu stated its phones will be “competitively priced” in the US market.
  • He added that Huawei does not expect to deal with security concerns in the US.
  • More information on the Huawei US carrier launch will be revealed at CES 2018.

After months of rumors and unconfirmed reports, the massive China-based phone company Huawei has finally and officially revealed that some of its handsets will be sold by US wireless carriers, starting sometime in 2018. The first such phone will be in its Mate 10 family of devices.

Editor’s Pick

The report comes from ABC News, quoting Richard Yu, the president of Huawei Technologies’ consumer business. He stated, “We will sell our flagship phone, our product, in the U.S. market through carriers next year.” The Mate 10, and its higher-end brother, the Mate 10 Pro, went on sale in China and other markets earlier this fall. Previous rumors claimed that the Mate 10 Pro would be sold by AT&T and Verizon in 2018. Yu did not state specifics on which carriers would sell its phones, but he did reveal that more information on those sales plans will be announced in early January during CES 2018.

While Huawei has sold phones under its own name and with its Honor brand in the US as unlocked devices online, breaking into the US carrier market could be huge for the company. Huawei is currently the number three seller of smartphones worldwide, trailing behind only Apple and Samsung. Yu stated today that the company’s phones, as sold by carriers, would be “competitively priced” in the US market.

He also added that Huawei does not expect its plans to be hit by security concerns by the US government. Some lawmakers and agencies have expressed concerns in the past that Chinese-based smartphone companies like Huawei could use those devices to spy on consumers. Today, Yu denied that would be the case, and suggested that those kinds of complaints were either politically motivated, or perhaps generated by its competitors.