Pages

Monday, May 30, 2016

Get HostName of WiFi hotspot clients and check if it is still connected


Previous posts show how to "Retrieve IP and MAC addresses from /proc/net/arp" and "Lookup manufacturer/vendor info from MAC address". This post show how to get the Host Name of the connected clients.

It can be noted that if we call getCanonicalHostName() or getHostName() methods of the InetAddressobjects, it will return  the IP address. If we call getLocalHost().getCanonicalHostName() or getLocalHost().getHostName() methods, it will return the host name, "localhost".

Also, if a devices disconnected, the file /proc/net/arp will not updated immediately. We can determine if it is still connected by calling inetAddress.isReachable(timeout). If false returned, means it is disconnected.

MainActivity.java
package com.blogspot.android_er.androidlistclient;

import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

Button btnRead;
TextView textResult;

ListView listViewNode;
ArrayList<Node> listNote;
ArrayAdapter<Node> adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnRead = (Button)findViewById(R.id.readclient);
textResult = (TextView)findViewById(R.id.result);

listViewNode = (ListView)findViewById(R.id.nodelist);
listNote = new ArrayList<>();
ArrayAdapter<Node> adapter =
new ArrayAdapter<Node>(
MainActivity.this,
android.R.layout.simple_list_item_1,
listNote);
listViewNode.setAdapter(adapter);

btnRead.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new TaskReadAddresses(listNote, listViewNode).execute();
}
});
}

class Node {
String ip;
String mac;
String CanonicalHostName;
String HostName;
String LocalHostCanonicalHostName;
String LocalHostHostName;
String remark;
boolean isReachable;

Node(String ip, String mac){
this.ip = ip;
this.mac = mac;
queryHost();
}

@Override
public String toString() {
return "IP: " + ip + " " +
"MAC: " + mac + " " +
"CanonicalHostName: " + CanonicalHostName + " " +
"HostName: " + HostName + " " +
"getLocalHost().getCanonicalHostName(): " + LocalHostCanonicalHostName + " " +
"getLocalHost().getHostName(): " + LocalHostHostName + " " +
"isReachable: " + isReachable +
" " + remark;
}

private void queryHost(){
try {
InetAddress inetAddress = InetAddress.getByName(ip);
CanonicalHostName = inetAddress.getCanonicalHostName();
HostName = inetAddress.getHostName();
LocalHostCanonicalHostName = inetAddress.getLocalHost().getCanonicalHostName();
LocalHostHostName = inetAddress.getLocalHost().getHostName();
isReachable = inetAddress.isReachable(3000);

} catch (UnknownHostException e) {
e.printStackTrace();
remark = e.getMessage();
} catch (IOException e) {
e.printStackTrace();
remark = e.getMessage();
}
}
}

private class TaskReadAddresses extends AsyncTask<Void, Node, Void> {

ArrayList<Node> array;
ListView listView;

TaskReadAddresses(ArrayList<Node> array, ListView v){
listView = v;
this.array = array;
array.clear();
textResult.setText("querying...");
}

@Override
protected Void doInBackground(Void... params) {
readAddresses();
return null;
}

@Override
protected void onPostExecute(Void aVoid) {
textResult.setText("Done");
}

@Override
protected void onProgressUpdate(Node... values) {
listNote.add(values[0]);
((ArrayAdapter)(listView.getAdapter())).notifyDataSetChanged();
}

private void readAddresses() {
BufferedReader bufferedReader = null;

try {
bufferedReader = new BufferedReader(new FileReader("/proc/net/arp"));

String line;
while ((line = bufferedReader.readLine()) != null) {
String[] splitted = line.split(" +");
if (splitted != null && splitted.length >= 4) {
String ip = splitted[0];
String mac = splitted[3];
if (mac.matches("..:..:..:..:..:..")) {
Node thisNode = new Node(ip, mac);
publishProgress(thisNode);
}
}
}

} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally{
try {
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}



Read More..

Saturday, May 28, 2016

The Weather Channel brings real time weather updates to users with Google Maps APIs




Editor’s note: Today’s guest blogger is Chris Huff, Vice President of Mobile Development at The Weather Channel. Read how The Weather Channel uses Google Maps APIs to power their popular Android app. The Weather Channel is just one of many customers who shared their story as part of our cross-country road trip, Code the Road.

We know from experience that the combination of weather, mapping and community input can result in ideas that keep people safe and informed. Our Android app goes far beyond basic weather forecasting, which is why we chose Google Maps. We use Google Maps Android API, Google Maps JavaScript API and ImageOverlays to place geodata, such as weather alerts, hurricanes and storm tracks and weather tiles, such as radar maps and clouds, on top of Google Maps.

Radar maps are one of the app’s main features, and we work hard to get them right. We get radar imagery from multiple sources and produce raster images from them. Then we take hundreds of the images and animate them in a frame-based animation sequence. The Google Maps Android API gives us overlays to place the animation on top of maps, and also lets us add additional objects such as pins and polygons to visualize lightning strikes or a storm’s direction. You can see an example below.



The more local weather reporting is, the more accurate it is; a thunderstorm may skip one neighborhood but hit another. So to improve accuracy and to build a community around our app, we’ve worked to make it more social. People send us information about weather near them, and we use the Google Maps Android API to add a pin to the map for each user-created report. Anyone can tap a pin to see the detailed report. Here’s an example of social weather reporting.
Social Weather Reports_The Weather Channel App for Android_framed.png

With more than 68 million downloads, the app has been a tremendous success. We get 2 billion requests for radar maps every year. There’s an old saying that everyone talks about the weather but no one does anything about it. We beg to disagree. With the Google Maps APIs we’re giving people detailed, useful live information about the weather, and we believe that’s doing quite a bit.

As part of the Code the Road series we hosted the 24-hour hackathon event, “Storm the Road: Hack for Safety with The Weather Channel and Google Maps”, on June 23. The event gave developers an opportunity to come together to create a new app or feature for mobile or web that helps keep the public safe and informed.
Read More..

Friday, May 27, 2016

New Google Apps Activity API

Back in January, Google Drive launched an activity stream that shows you what actions have been taken on files and folders in your Drive. For example, if someone makes edits on a file you’ve shared with them, you’ll see a notification in your activity stream.

Today, we’re introducing the new Google Apps Activity API designed to give developers programmatic access to this activity stream. This standard Google API will allow apps and extensions to access the activity history for individual Drive files as well as descendents of a folder through a RESTful interface.

The Google Apps Activity API will allow developers to build new tools to help users keep better track of what’s happening to specific files and folders they care about. For example, you might use this new API to help teachers see which students in their class are editing a file or, come tax season, you might want to create a quick script to audit the sharing of items in your financial information folder.

Check out the documentation at https://developers.google.com/google-apps/activity/. We cant wait to see what you build!

Posted by Justin Hicks, Software Engineer, Technical Lead for Google Apps Activity API
Read More..

Racing Rivals 4 1 MOD APK Unlimited Boost Free Full Latest Version Data Files Download

Racing Rivals 4.1 MOD APK Unlimited Boost

rivals_01

What’s In The MOD: v 4.1.0
– TurboCharger Active During Race (Not for opponents)
– SuperCharger Active During Race (Not for opponents)
– Unlimited Boost
– Removed Ban
– Removed Cheat Detection
– Unlimited Videos for Rewards
Requires Android: 2.3 and Up
Version: 4.1.0
MODE: ONLINE
PLAY LINK: RACING RIVALS

DOWNLOAD LINKS

Click Here For Download Links
Read More..

Winners of the Ice Cream Sandwich VS iOS5 contest

Dear readers we are glad to announce the winners of our Ice Cream Sandwich VS iOS5 contest:

The winners of the first prize: Android a Complete Course:
Jim from http://sakiko.com/
and
Believer.

The winner of the second prize: Android a Quick Course:
Corneliu Dascalu

The winners of the third prize Android, an Enterprise Edition Vision:
Will.i.am

for the winners please contact me at m.s.ramzy@gmail.com to send you the copies of the books
thanks a lot for all the participants and good luck next time.

Read More..

Thursday, May 26, 2016

Our commitment to protecting your Google Apps information



Editors note: Our guest blogger this week is Marc Crandall, Head of Global Compliance at Google for Work. A lawyer and long time Googler, Marc focuses on regulatory matters involving privacy and security.

We regularly hear from our customers that assessing data protection compliance in various countries around the world can be challenging. Protecting the privacy and security of our customers’ information is a top priority, and we take compliance very seriously. That’s why weve been working hard to make things a bit easier for you.

We recently launched a new legal and compliance section of the Google Admin console where Google Apps administrators can find pointers to useful information, such as security and privacy certifications, third-party audits and data center and subprocessor information. This will be helpful to everyone, from those who manage their own domain to legal, security and privacy compliance specialists.

Another important resource for Google Apps for Work customers is our data processing amendment, which we’ve offered to customers since 2012. Customers that use our products for Work and for Education are often subject to data protection and compliance regulations. To help address this, in addition to our commercial agreements, we offer a data processing amendment that describes Google’s specific data protection commitments for your Google Apps information.

If you operate in a regulated industry, having Google’s data protection obligations in writing helps demonstrate to regulators that we take significant and concrete steps to protect your information. For customers subject to laws implementing the European Union’s Data Protection Directive, our data processing amendment also contractually binds us to remain enrolled in the U.S Department of Commerce Safe Harbor Program. And we indicate that Google Apps customers may opt-in to model contract clauses with Google.

While the data processing amendment does not affect the functionality of Google Apps, we believe customers with regulatory compliance considerations will find the amendment useful. You can access the data processing amendment from within the Admin console.

Millions of organizations use Google for Work today — they come from all sectors and more than half of our customers operate outside of the United States. You rely on Google to provide strong data protection capabilities, in compliance to your specific needs. With these tools in place, we hope to make it easier for you and third parties to verify that. For more information, visit our Google for Work and Google for Education trust site.
Read More..

Get your Google Drive App listed on the Google Apps Marketplace

The Google Apps Marketplace brings together hundreds of third-party applications that integrate and enhance Google Drive, part of Google Apps for Work, our suite of collaboration and productivity tools for businesses. To improve discoverability and increase adoption, it’s important to make your Google Drive app integration available on the marketplace.

Today, we want to share with you four easy steps to get listed immediately and enable admins to install your application for all users in their domain. For more details, check out the Google Apps Marketplace documentation.

Step 1: Open your Drive project on Google Cloud console. Turn on “Google Apps Marketplace SDK” for your project. Screen Shot 2014-08-20 at 11.50.10 PM.png

Step 2: Click the gear icon to configure “Google Apps Marketplace SDK”. Refer to Google Apps Marketplace documentation for details. In the scopes section, be sure to request the same scopes as your Google Drive application, and check the “Enable Drive extension” checkbox.

Step 3: Go to the Chrome Web Store developer console and select your published Drive application.

Step 4: Update the following line in your Drive application’s Chrome Web Store manifest, upload and publish.

"container":"GOOGLE_DRIVE"
with
“container”: [”GOOGLE_DRIVE”, ”DOMAIN_INSTALLABLE”]


You’re done! You application is now available to all Google Apps for Work customers to install on a domain-wide basis through the Google Apps Marketplace. Refer to Publishing your app documentation for details. You can access Google Apps Marketplace inside Google Admin Console and verify your newly listed application.

Please subscribe to the Google Apps Marketplace G+ community for the latest updates.
Posted by Hiranmoy Saha, Software Engine, Google Apps Marketplace
Read More..