Wednesday, 31 May 2017

Andy Rubin, creator of Android, debuts his new Essential Phone


Andy Rubin helped create the modern mobile era by steering Google�s Android efforts for nearly a decade. He also built Google�s mobile and digital content businesses, and started Google�s robotics efforts via the acquisitions of Boston Dynamics, Schaft and others. Rubin is the founder and CEO of Playground Global, a venture studio that provides investment, mentorship and resources to tech startups working in the area of hardware and AI. Now, he's launching a new company and phone, called Essential.


Tuesday, 23 May 2017

Programming Kotlin

Familiarize yourself with all of Kotlin's features with this in-depth guide

Programming Kotlin

About This Book
  • Get a thorough introduction to Kotlin
  • Learn to use Java code alongside Kotlin without any hiccups
  • Get a complete overview of null safety, Generics, and many more interesting features
Who This Book Is For
The book is for existing Java developers who want to learn more about an alternative JVM language. If you want to see what Kotlin has to offer, this book is ideal for you.

What You Will Learn
  • Use new features to write structured and readable object-oriented code
  • Find out how to use lambdas and higher order functions to write clean, reusable, and simple code
  • Write unit tests and integrate Kotlin tests with Java code in a transitioning code base
  • Write real-world production code in Kotlin in the style of microservices
  • Leverage Kotlin's extensions to the Java collections library
  • Use destructuring expressions and find out how to write your own
  • Write code that avoids null pointer errors and see how Java-nullable code can integrate with features in a Kotlin codebase
  • Discover how to write functions in Kotlin, see the new features available, and extend existing libraries
  • Learn to write an algebraic data types and figure out when they should be used
In Detail
Kotlin has been making waves ever since it was open sourced by JetBrains in 2011; it has been praised by developers across the world and is already being adopted by companies. This book provides a detailed introduction to Kotlin that shows you all its features and will enable you to write Kotlin code to production.

We start with the basics: get you familiar with running Kotlin code, setting up, tools, and instructions that you can use to write basic programs. Next, we cover object oriented code: functions, lambdas, and properties - all while using Kotlin's new features.

Then, we move on to null safety aspects and type parameterization. We show you how to destructure expressions and even write your own. We also take you through important topics like testing, concurrency, microservices, and a whole lot more. By the end of this book you will be able to compose different services and build your own applications.

Style and approach
An easy to follow guide that covers the full set of features in Kotlin programming.

Kotlin for Android Developers: Learn Kotlin the easy way while developing an Android App

Kotlin for Android Developers: Learn Kotlin the easy way while developing an Android App

Are you tired of using an ancient, inexpressive and unsafe language to develop your Android apps? Do you cry out loud every time you see a Null Pointer Exception in your bug tracker? Then Kotlin is your solution! A language specifically created for Java developers, easy to learn, expressive, null safe and really intuitive. Your productivity will boost and your apps will become more robust. Learn Kotlin the easy way by example and discover the tricks that will make coding easier. In this book, I'll be creating an Android app from ground using Kotlin as the main language. The idea is to learn the language by example, instead of following a typical structure. I'll be stopping to explain the most interesting concepts and ideas about Kotlin, comparing it with Java 7. This way, you can see what the differences are and which parts of the language will help you speed up your work. This book is not meant to be a language reference, but a tool for Android developers to learn Kotlin and be able to continue with their own projects by themselves. I'll be solving many of the typical problems we have to face in our daily lives by making use of the language expressiveness and some other really interesting tools and libraries. The book is very practical, so it is recommended to follow the examples and the code in front of a computer and try everything it's suggested. You could, however, take a first read to get a broad idea and then dive into practice.

Monday, 22 May 2017

Download and install Android Studio 3.0 Canary 1 on Ubuntu 17.04

This post show how to Download and install Android Studio 3.0 Canary 1 on 64-bit Ubuntu 17.04, over Windows 10/Oracle VirtualBox,


Firstly, Install Ubuntu 17.04 on Windows 10/Oracle VirtualBox.

Before install Android Studio on 64-bit Ubuntu 17.04, install 32-bit libraries:
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386

(details refer to Fix "Unable to run mksdcard SDK tool" when install Android Studio on Linux)

Download Android Studio 3.0 Canary, visit https://developer.android.com/studio/preview/index.html
Unpack the ZIP file, to any directory you want.
Open a terminal, navigate into <android-studio>/bin/ and execute studio.sh

This video show how:


Setup for debugging on real device:

On Ubuntu/Linux, to debug on real device, you have to set up your system to detect your device.
(referencec: https://developer.android.com/studio/run/device.html#setting-up)

Edit/Create /etc/udev/rules.d/51-android.rules
$ sudo nano /etc/udev/rules.d/51-android.rules

Add the code:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"

Where 00b4 is the vendor ID, replace it to match your device. For my Samsung device, replace with 04e8.

You can check your USB vendor ID here: https://developer.android.com/studio/run/device.html#VendorIds.

or try to find it using lsusb command.



Kotlin programming language, Now official on Android. It's a dummy Hello World of Kotlin language, created in Android Studio 3.0 Canary 1.



Get USB devices' vendor ID and product ID on Linux, using lsusb command

To get the vendor ID/product ID of attached USB devices in Linux, you can use the command lsusb.

This video show how to, tested on Ubuntu 17.05 over Windows 10/Oracle VirtualBox 5.1




reference: Ubuntu Manual - lsusb



Saturday, 20 May 2017

Install Ubuntu 17.04 on Windows 10/Oracle VirtualBox


This video show how to install Install Ubuntu 17.04 on Windows 10 with Oracle VirtualBox 5.1. Basically, the steps is very straightforward.


But...after setup, I cannot google in the browser. And it was found some sites can be reached, some sites cannot. Even cannot run apt-get update. After some searching, I found it's related to DNSSEC in /etc/systemd/resolved.conf.

To fix it, edit the file /etc/systemd/resolved.conf:
$ sudo nano /etc/systemd/resolved.conf

uncomment #DNSSEC=allow-downgrade and replace allow-downgrade with off .


Save and Exit
Reboot

This video show how:


reference:
This page have a good explanation: Hectic Geek - Websites Not Loading (dns issue) After Installing Ubuntu 17.04? [fix]

Install Guest Addition:
The Guest Additions are designed to be installed inside a virtual machine after the guest operating system has been installed. They consist of device drivers and system applications that optimize the guest operating system for better performance and usability. (https://www.virtualbox.org/manual/ch04.html)

It's strongly recommended to install Guest Addition. In case of Ubuntu 17.04, simple click Devices on VirtualBox menu bar, and click Insert Guest Addition CD image...



Share folder between host Windows 10 and guest Ubuntu 17.04:
Starting with version 4.0, VirtualBox can mount shared folders automatically, at your option (link). This video show how to set auto-mount share folder in host Windows 10, and also add user to vboxsf group in guest Ubuntu to access the share folder. (Guest Addition is need)


Friday, 19 May 2017

Fix "Unable to run mksdcard SDK tool" when install Android Studio on Linux

If you install Android Studio on 64-bit Linux and reported with error:
Unable to run mksdcard SDK tool



Most probably some 32-bit libraries are missed.

If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following command:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 lib32bz2-1.0

If you are running 64-bit Fedora, the command is:
sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686

reference: Troubleshoot Android Studio - Linux libraries


When I try to install the 32-bit libraries on Ubuntu 16.04.2 LTS (64-bit) on VirtualBox with the command:

$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 lib32bz2-1.0

The errors reported:
E: Unable to locate package lib32bz2-1.0
E: Couldn't find any package by glob 'lib32bz2-1.0'
E: Couldn't find any package by regex 'lib32bz2-1.0'

To fixed it, add 32 bit architecture with the command:
$ sudo dpkg --add-architecture i386
$ sudo apt-get update

Re-install with the command 
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386


Done:


Android Studio 3.0 available on canary release channel

Just in time for Google I/O 2017, Android Studio 3.0 is available to download on  canary release channel.

To accelerate your development flow, Android Studio 3.0 includes three major features: a new suite of app performance profiling tools to quickly diagnose performance issues, support for the Kotlin programming language, and increased Gradle build speeds for large sized app projects. Android Studio 3.0 also tightly integrates with Android platform development with these additional key features: support for Instant App development, inclusion of the Google Play Store in the Android O emulator system images, and new wizards for Android O development. Overall, this first canary release of Android Studio 3.0 has 20+ new features.



Please refer to the announcement blogpost "Android Studio 3.0 Canary 1" for more details.

Thursday, 18 May 2017

Kotlin programming language, Now official on Android

At Google I/O 2017 keynote, the Android team announced first-class support for Kotlin. Kotlin is a statically typed programming language for modern multiplatform applications

Starting now, Android Studio 3.0 ships with Kotlin out of the box, meaning Android developers no longer need to install any extras or worry about compatibility. It also means that moving forward, you can rest assured that both JetBrains and Google will be supporting Android development in Kotlin.

~ read more

This tutorial, Getting started with Android and Kotlin, walks us through creating a simple Kotlin application for Android using Android Studio.


Related:
Download and install Android Studio 3.0 Canary 1 on Ubuntu 17.04, and create Hello World of Kotlin language.

Video playlist of Google I/O 2017 - All Sessions

If you missed Google I/O 2017 live videos, you can review here:

Tuesday, 16 May 2017

Developer Preview 4 of Android Things released

Developer Preview 4 of Android Things released, bringing new supported hardware, features, and bug fixes to the platform. This version support Google Assistant SDK on all Android Things certified development boards.

know more: Android Developers Blog - Android Things Developer Preview 4

It's time to install Google I/O 2017 app on your phone

The official Google I/O 2017 conference app is your co-pilot to navigate the conference, whether you're attending in-person or remotely. With the app, you can:

� Explore the conference schedule, with details on topics and speakers
� Save events to My I/O, your personalized schedule
� Get reminders before events you�ve saved in My I/O start
� Sync your custom schedule between all of your devices and the I/O website
� Watch the keynote and sessions in real time via the livestream
� Guide yourself using the vector-based conference map
� Opt-in to receive important notifications about the event, schedule, travel, after hours, session recordings and more
� Read about the latest event details in the Feed

Exclusive for onsite attendees:
� Take advantage of facilitated pre-event WiFi configuration
� Reserve seats for events ahead of schedule

Source code for the app will be available soon after I/O.

Sunday, 14 May 2017

Saturday, 13 May 2017

Microsoft's Customer Guidance for WannaCrypt attacks and security update, including Windows XP, Windows 8, and Windows Server 2003

In these two day, many Windows users affected by the malicious �WannaCrypt� software. Microsoft posted "Customer Guidance for WannaCrypt attacks", the steps to stay protected. Additionally, Microsoft are taking the highly unusual step of providing a security update for all customers to protect Windows platforms that are in custom support only, including Windows XP, Windows 8, and Windows Server 2003. Windows 10 were not targeted by the attack up to now.

Link ~ Microsoft TechNet - Customer Guidance for WannaCrypt attacks


Treble: A modular base for Android

With Treble in coming Android O, device-maker will easier to update devices to a new version of Android.

know more: Android Developers Blog - Here comes Treble: A modular base for Android


How to disable "SMB 1.0/CIFS File Sharing Support" in Windows 10


Open Control Panel
- Program

- Programs and Features > Turn Windows features on or off

- Uncheck "SMB 1.0/CIFS File Sharing Support"

- And restart your computer


Reference:
~ Microsoft Support: How to enable and disable SMBv1, SMBv2, and SMBv3 in Windows and Windows Server

Friday, 12 May 2017

Add button inside Toolbar

This example modify from my old post "Implement checkable items in OptionsMenu of Toolbar" to add button to Toolbar.


Edit activity_main.xml to add Button inside android.support.v7.widget.Toolbar:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="com.blogspot.android_er.androidtoolbar.MainActivity">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="#FFA000">
<Button
android:id="@+id/toolbarbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_gravity="right"/>

</android.support.v7.widget.Toolbar>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</LinearLayout>

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

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

Button toolBarBtn;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

getSupportActionBar().setTitle("Toolbar example");
toolbar.setSubtitle("Android-er.blogspot.com");
toolbar.setLogo(android.R.drawable.ic_menu_info_details);

toolBarBtn = (Button)findViewById(R.id.toolbarbtn);
toolBarBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(),
"Button in ToolBar clicked",
Toast.LENGTH_LONG).show();
}
});

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

Toast.makeText(this, item.getTitle(), Toast.LENGTH_LONG).show();

int item_id = item.getItemId();
switch(item_id){
case R.id.item_checkable1:
if(item.isChecked()){
item.setChecked(false);
}else{
item.setChecked(true);
}
break;
case R.id.item_checkable2:
if(item.isChecked()){
item.setChecked(false);
}else{
item.setChecked(true);
}
break;
}

return super.onOptionsItemSelected(item);
}
}



Learn about Places and the Google Maps Places API

Google Maps Places API make your app stand out with detailed information about 100 million places across a wide range of categories, from the same database as Google Maps and Google+.

Learn about Places and the Google Maps Places API over Coffee with Fontaine Foxworth

Learn more about the Places API: https://developers.google.com/places/
Watch a Geocast on how to use it in a game: https://goo.gl/oRMKWh

Coffee with a Googler meets with Fontaine Foxworth to talk about the Places API in Google Maps. Places give locations in the world semantic meaning. Your favorite coffee shop isn't just an address or a latitude and longitude, it's a place. With the API, you can locate and get metadata about a place, giving you lots of fun applications you can build!

Watch more episodes of Coffee with a Googler here: https://goo.gl/5l123N
Subscribe to the Google Developers Channel: http://goo.gl/mQyv5L


Wednesday, 10 May 2017

I/O Live Widget



I/O Live Widget is a widget to embed on your website that allows you to deliver highlights and live announcements directly from Google I/O. It features the following elements:
  • The complete I/O live video stream (this includes the keynote and all livestreamed sessions).
  • Social feed from @GOOGLEDEVS.

Customize the widget at: https://events.google.com/io/widget/


Monday, 1 May 2017

Learning Embedded Android N Programming

Learning Embedded Android N Programming

Key Features
  • Understand the system architecture and how the source code is organized
  • Explore the power of Android and customize the build system
  • Build a fully customized Android version as per your requirements
Book Description
Take a deep dive into the Android build system and its customization with Learning Embedded Android Programming, written to help you master the steep learning curve of working with embedded Android. Start by exploring the basics of Android OS, discover Google's �repo� system, and discover how to retrieve AOSP source code. You'll then find out to set up the build environment and the first AOSP system. Next, learn how to customize the boot sequence with a new animation, and use an Android �kitchen� to �cook� your custom ROM. By the end of the book, you'll be able to build customized Android open source projects by developing your own set of features.

What you will learn
  • Master Android architecture and system design
  • Obtain source code and understand the modular organization
  • Customize and build your first system image for the Android emulator
  • Level up and build your own Android system for a real-world device
  • Use Android as a home automation and entertainment system
  • Tailor your system with optimizations and add-ons
  • Reach for the stars: look at the Internet of Things, entertainment, and domotics
About the Author
Ivan Morgillo is a computer engineer, a conference speaker, and a community organizer. He is passionate about programming and embedded systems�from DIY domotics to Android devices.

He is cofounder of Alter Ego Solutions, a mobile development consulting company.

He is also the author of RxJava Essentials, by Packt Publishing and Grokking Rx, by Manning Publications.

Stefano Viola is an embedded software developer with proved experience with Linux embedded devices and microcontrollers. He is an Android platform expert and application developer. He is passionate about programming and embedded systems, from DIY domotics and robots to customized Android devices.

He is currently working at SECO as an embedded software engineer. He is part of AXIOM project, an R&D project by the European Community, and the UDOO team.

Table of Contents
  1. Understanding the Architecture
  2. Obtaining the Source Code � Structure and Philosophy
  3. Set up and Build � the Emulator Way
  4. Moving to Real-World Hardware
  5. Customizing Kernel and Boot Sequence
  6. "Cooking" Your First ROM
  7. Tailoring Your Personal Android System
  8. Beyond the Smartphone