Android Tutorial Android Things - Getting Started

Android Things is a new project of Google that extends the Android OS to SoC (System on a Chip) boards such as Raspberry Pi and Intel Edison.

https://developer.android.com/things/index.html

To get started you need to install the Android Thing image on the SoC computer.
Instructions for Raspberry Pi 3 are available here: https://developer.android.com/things/hardware/raspberrypi.html

Tip: Use 7zip to unzip the zipped image file. Windows Explorer might fail to extract it due to its size.

The next step is to connect ADB to the remote computer. ADB is the tool used to connect to a device in USB debug mode.
You can find it under <android sdk>\platform-tools.

You can use this command to connect:
B4X:
adb connect Android.local

Check that it is actually connected with
B4X:
adb devices
Once connected you can develop with it like you develop with a regular Android phone.

The platform is a bit slow and it will hard crash if you try to access a feature that is not supported. Check the unfiltered logs for more information.

You can add this code to the manifest editor to make your program the default program that starts after boot:
B4X:
AddActivityText(Main,
  <intent-filter>
  <action android:name="android.intent.action.MAIN"/>
  <category android:name="android.intent.category.IOT_LAUNCHER"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
)

Tips:
- You can uninstall a program with:
B4X:
adb uninstall <package name>
- If there are multiple connected devices then you need to add "-s Android.local:5555" to the adb commands.
- You can also use B4J to target these platforms. The advantage of B4A is that it supports UI applications (the ARM Java package doesn't include the UI package).
The advantage of B4J is that you can use jServer library to implement servers. There are other advantages for using Linux instead of Android for server applications.
- Set the #SupportedOrientations attribute to landscape if the screen orientation is wrong.
- Things library (provides access to the hardware pins): https://www.b4x.com/android/forum/threads/android-things.74823/
- From my experience the Wifi settings mentioned in Google tutorial should be avoided. It caused problems with the reported ip address.

.

Source code: https://www.b4x.com/android/forum/threads/72149/#content
Change this line:
B4X:
lblMyIp.Text = "My ip: " & Starter.server.GetMyWifiIP
'To
lblMyIp.Text = "My ip: " & Starter.server.GetMyIP
 
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Toley

If I am not mistaken (if I understood Erel correctly), Android things support UI on PI 3.

What I would like to know is this:
Is the Non-UI thing a limitation of B4J or something else. After all, many of these boards have HDMI .

Thanks for your reply
 
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Guys

I have one more question with regards to this.

Have any one tested how high of a frequency can be accurately read (without missing any pulses) using Pi3 with B4A, and is there a difference in performance whether we use B4A or B4J. Please note that I am referring to interrupt mode (listener) and not tight loop.

Thanks in advance
 

walterf25

Expert
Licensed User
Longtime User
See the Things library: https://www.b4x.com/android/forum/threads/android-things.74823/#content


I'm not familiar with Brillo.
Android Things is not open source.


It is possible but not needed. It uses ADB over wifi. You just need to run adb connection Android.local
Hi Erel, i'm playing with a raspberry pi 3 and i was able to load the development image on it, i'm having some problems understanding how to connect to it through ADB, i have a USB to TTL cable connected but i can't seem to get a connection, i just came across this post and noticed you mention that we can use ADB through wifi, how can we accomplish this, how can we install the B4ABridge on the raspberry pi in the Android Things image.

Regards,
Walter
 

walterf25

Expert
Licensed User
Longtime User
The steps are explained in the first post. You don't need to use B4A-Bridge as you will use ADB instead.
Hi Erel, thanks for your reply, i was having issues connecting to the raspberry pi through ADB for some reason i think the connection is being rejected on my network somehow, i was using my job's wifi connection.

I created a hot spot with my cell phone and connected both my laptop and raspberry pi to the hot spot and was able to connect just fine after that.

Regards,
Walter
 

Blueforcer

Well-Known Member
Licensed User
Longtime User
Just for your information.
It works fine with the official Raspberry 7" Touchscreen, incl Multitouch, out of the box!
Thanks for this tutorial!
 

fbritop

Active Member
Licensed User
Longtime User
Just for your information.
It works fine with the official Raspberry 7" Touchscreen, incl Multitouch, out of the box!
Thanks for this tutorial!

Can you provide me the link to the Touch LCD please...

Thanks
FBP
 

Rafael Ruiz

Member
Licensed User
Longtime User
Hello all.
I have an issue, I added the code to the manifest editor to start my program after boot, but the program doesn't start, what can i do? Thanks in advance
 

DonManfred

Expert
Licensed User
Longtime User
I have an issue
You better should create a new Thread in the questions forum for any issue you have. Do not post to existing threads.
 

Tareq Khan

Member
Licensed User
Longtime User
The manifest editor code posted in the 1st post to make the program automatically start after boot did not work for me.

The following code worked. :)

B4X:
AddActivityText(Main,
<intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.HOME"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
)
 
Top