Google Nearby not working on Android Things by default - android

I'm developing an Android Things application on the iMX7D development board and I have implemented Google's Nearby services. The issue I have is that I get an error (sometimes) when I begin advertising the device. Here is the error:
com.google.android.gms.common.api.ApiException: 17: API: Nearby.CONNECTIONS_API is not available on this device.
I have managed to fix the error by following the instructions on https://stackoverflow.com/a/51428433/6377151, and that allows the code to run fine. The error gets fixed if I run the ADB command
adb shell am force-stop com.android.iotlauncher.ota
And then run the application, but that only works for the one time. As soon as the device is rebooted, the issue comes back. I'm aware that this is because the default launcher is already advertising the device, but I'm not sure how to fix this issue in code automatically when my application runs. But I need a way to either do this automatically on startup or to overcome the error in another way.
My Android Things device is running Android Things 1.0.10. Can anyone assist?

Disclaimer: I work on Nearby.
We have a release ready to allow multiple apps to advertise/scan at the same time. It's code-complete, but code pushes are slow at Google. It'll be a while before it's public. Note: Android Things boards might need to be reflashed to get the update. That was the case in development, but is hopefully not the case for release builds.
In the meantime, you'll unfortunately have to either install another launcher, or force stop the existing one. We treat clients as first-come-first-serve.

Related

Android Studio "Waiting For Process" only when used with a wearable device

I'm having an incredibly frustrating time using Android Studio with wearable devices.
The problem is that when I try to run or debug the wearable app Android Studio doesn't do anything most of the time, it hangs there with the last message being
"Waiting for process: com.name of my wearable app".
I can get it to work maybe 10% of the time, then it stops and I might be messing around for 40 minutes before I can get it to work again.
I don't have any issues at all using Android Studio to debug the phone part of the app, its only the wearable part.
Once its stopped working then 1) restarting the watch doesn't fix it, 2) restarting abd doesn't fix it, 3) restarting Android Studio doesn't fix it, 4) manually killing the app process on the watch doesn't fix it. The only thing that will work is to reset the watch. However the entire process of resetting the watch, re-pairing, re-running AS takes about 15 minutes and then afterwards AS will only permit interactive debugging a few times before it stops again. I can't reset the watch everytime AS throws a tantrum, its too time consuming and making my blood pressure rise to dangerous levels.
Something I've frequently noticed is if I try and exit Android Studio it asks: "Do you want to disconnect from the process 'wear'? and if I select the disconnect button then it just sits then and Android Studio never quits.
This is driving me absolutely insane, does anybody please have any experience using the Android Studio debugger with a wearable and has any suggestions how I can some sort of reliability.
Its AS version 1.1.0, using with Lollipop.
Note the wearable app starts/launches/runs perfectly if I'm not using Android Studio, so I don't think there are any issues with the app itself.
******* UPDATE **********
Just updated to AS 1.1.0 today and when trying to debug the wearable it popped up a dialog saying it was unable to open the debugger port
.
popped up a dialog saying it was unable to open the debugger port .
Check the port number. It should be same as in JAVA_OPTIONS and AS Debugger remote configuration under port no.
in command prompt run this :
ping 127.0.0.1:8601
check port 8601 not in firewall list
or used by another program

Android TV SDK : Setting Proxy for the Emulator?

I have installed the Android TV SDK Developer preview for Windows. I am in a corporate intranet environment. I can start the Emulator, but the main screen endlessly loops with the "Preparing Recommendations" animation. I can navigate to the Settings and see that there is no network (no wired and no ethernet).
I suspect this might be a proxy issue. I have tried launching the Emulator with the following command:
C:\Eclipse_w_Android\adt-bundle-windows-x86-20140624\sdk\tools>emulator -avd AVD_for_Android_TV_1080p_by_Google_X86 -http-proxy http://MY_PROXY_IP:8080
(MY_PROXY_IP is replaced with my company's IP address)
It launches the Emulator but doesn't seem to have any effect on the network.
Has anyone else been able to get the Android TV Emulator to fully load in a heavily firewalled / proxied environment?
I thought I was experiencing this issue as well (and had originally commented as such), but I later realized that there was no actually connectivity problem. Two things to note:
"Preparing Recommendations" will appear indefinitely, and I presume this is simply because there are no apps by default feeding recommendations to populate this screen.
Both the Ethernet and Wireless items will show that they are not connected. However, if you run an app that uses the network (a simple WebView is sufficient as long as the app has INTERNET permissions), you'll see that it connects just fine.
I would suggest trying a test app to check connectivity, as there is no other indicator I can find suggesting that it is working properly. I suspect you'll find that all is well.
you probably forgot the first part username password # server port
your company probably has the ip setup with username password

Testing an android app for restart functionality

I am trying to develop an Android App that, though having an Activity, needs to run in the background as a service. The app needs to start up automatically after rebooting the phone/device.
My question is HOW to troubleshoot such requirements, since the LogCat gets disconnected when the phone is rebooted, even using "adb shell broadcast -am android.intent.action.BOOT_COMPLETED" on a connected phone. (Though possible on an emulator, I dont feel like it is able to properly replicate real-world scenarios). I would like to be able to see the Logcat messages after device restarts, thus allowing me to troubleshoot ANRs and app crashes during reboot.
Any pointers would be appreciated.
Based on this link, I understand the closest we can get to debugging reboot errors is to use
adb logcat -v time > <localfile>
or
adb bugreport
Both of these options may not be the cleanest ways to pinpoint the issue, but atleast something is better than nothing.

Retrieve adb logcat files from a client's device

I'm making an app for a client, and they are experiencing bugs that no one else can reproduce. They are not close to us, so I can't physically go to them and hook their device up to my laptop.
Is there a way that they can get hold of their logcat files without having to install adb on a machine first, i.e. can they email them straight from their device? I'm not sure how tech-savvy they are, and ideally I don't want to spend too much time telling them how to install adb if I can get the files some other way.
Obviously I'm looking to do it with their permission (and I'm expecting that installing adb is going to be the only way).
Edit: I should add that I'm using Corona SDK, so will not be able to access the logs from directly inside the app. Also, all devices are 4.1+ so the various log collector apps have not worked.
You can redirect the logcat to a file and send it by email using your app.
Check here how to save the logcat into a file.

Getting crash logs, debug information from android users?

This is my first android app.
The code that is heavily tied to hardware features such as the sample rate of the on-board sensors. On most devices the app works, on some I can catch the error and display a message saying that the device is not compatible, but on some devices (perhaps the fault of the phone manufacturer or faulty drivers), the device simply crashes. I need to know where the crash happens and for what devices.
Does a service exist that will enable me to collect debug information and crash logs from an android app I release on the marketplace. For example, something that will send statistics every time a user's app crashes an interface similar Windows Error reporting appears?
Use Acra.
it sends you detailed log right to your google docs
http://code.google.com/p/acra/
Look into https://www.crittercism.com, we use it, and it works nicely.
There's also an open source project for this: http://code.google.com/p/acra/

Categories

Resources