I wrote an Android app with a button that raises KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE to control third party media player apps. This works perfectly for several days or weeks, but then the key event starts being intercepted by Google Assistant, which is ostensibly turned off. Sometimes it pops up a notification inviting me to turn on various Google Assistant features. Sometimes it speaks the time. And sometimes it just makes the Google Assistant sound but does nothing else. In any case, sometimes the key event is also received by third party media players, sometimes not. Rebooting the device resolves the issue for another week or two.
The app is extremely simple. Here's the related code:
In onCreate:
findViewById(R.id.play_button).setOnClickListener(view -> {
sendKey(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
});
And the definition of sendKey:
private void sendKey(int keyCode) {
KeyEvent down = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode);
mAudioManager.dispatchMediaKeyEvent(down);
KeyEvent up = new KeyEvent(KeyEvent.ACTION_UP, keyCode);
mAudioManager.dispatchMediaKeyEvent(up);
}
I know this kind of bizarre behavior is often device- or carrier-specific, so I don't know how to further investigate or report it unless someone else has encountered the same issue. Have you seen this, and is there a solution? The device I've experienced this on is a fully updated Motorola Moto G7 Supra from cricKet, running Android 10.
A deleted answer linked to this article: How to Stop Google Assistant from Popping up Randomly. The article seems to have been written for Android 9, and some of the options have already changed in Android 10, so reproducing the content of the article wouldn't be very valuable. The takeaway from the article is that turning off the Google Assistant malware doesn't actually turn it off. You have to opt out in multiple places, and Google keeps adding more. Anyone who finds this Q&A in the future should browse the settings for more new switches.
As I mentioned in the question, Google Assistant was already "turned off" on my device (procedure 1, step 4 in the article). But there's a new section of Assistant Settings titled Your Apps. Each app listed there has a switch labeled Let your Assistant learn from this app.
My device had been running for a couple weeks and Google Assistant was messing with my key events. I turned off the "learn" switch for the app in question and the problem went away without a reboot.
Edit: approximately three weeks after turning off "learning" seemed to solve the problem, it came back. I have now resorted to force closing and disabling the Google app.
Related
My wife has tiktok on her phone, it's an old Huawei Nova 3i, suddenly the notification of receiving a message changed. After I played around with the notifications' sounds I changed that of a direct message, however and scrolling down, I noticed another enabled notification sound named:
X_AUDIO_DEFAULT_SERVICE_CHANNEL
I disabled it, looked it up online as "what's X_AUDIO_DEFAULT_SERVICE_CHANNEL"
I found this link:
https://mogua.co/view_file/?file=X/C67006QSk.java&md5=61e8aae62e843b22cf9dc1cbe9f6e82e&type=apk&appname=TikTok&lines=126,142,128
I urlscanned it, then scamadviced it: nothing
Opened it: saw some code in there
Not sure what it is, any professional opinion, please!
Should we worry about her data?!
When trying to set up hand tracking following the hand tracking-documentation unity just shuts down when pressing play without any crashlog/warning. Here are the steps that I have done up until the crash to reproduce my problem:
Creating completely new scene.
Importing the Oculus Integration from asset store.
Switching platform to Android.
Add OVRCameraRig to hierachy.
Change OVRCameraRig's Hand tracking support to "Controllers & Hands" on OVR Manager-script.
Up to step 5 I can press play whenever and it starts as usual. But when doing the next step it crashes everytime.
Add "OVRHandPrefab" to OVRCameraRig > TrackingSpace > LeftHandAnchor/RightHandAnchor.
Has anyone experienced a similar problem to this?
Thanks in advance!
EDIT: Unity does not crash when removing Link cable from laptop. So has certainly something to do with link.
Have you tried enabling hand tracking in your Quest Headset (while unplugged)?
Its in Settings -> Experiments -> Enable Hand Tracking
I also have 'Auto detect hands or controllers' enabled. To see your hands, the new OVRCustomHandPrefab does the trick.
[Edit]
Also the headset seems to cause crashes after its been sitting on the desk connected to Link for more than a few minutes. Unplugging and reconnecting will refresh it.
I don't know if you were able to solve this issue or not, but for any other person who is facing a similar issue, here is how I solved it:
When you add OVRHandPrefab to LeftHandAnchor and RightHandAnchor, set the gameobject to false in the inspector.
Then in your script, check if handtracking is enabled by running this code in Update() OVRPlugin.GetHandTrackingEnabled()
Set both the OVRHandPrefab to true only when OVRPlugin.GetHandTrackingEnabled() returns true, something like this:
if (OVRPlugin.GetHandTrackingEnabled())
{
ovrHandPrefabLeft.SetActive(true);
ovrHandPrefabRight.SetActive(true);
}
else
{
ovrHandPrefabLeft.SetActive(false);
ovrHandPrefabRight.SetActive(false);
}
This should avoid Unity from crashing.
I have a popular read aloud app, that is also often used by visually impaired and blind people. Some, very few of them complain that when using the app or having it read aloud, it repeatedly says "Service at Voice" (my app's name is #Voice Aloud Reader). I tested this on several phones with different versions of Android and TalkBack enabled, but couldn't reproduce this problem.
The app is showing a notification with reading progress and buttons to pause/resume, FF and reverse etc. Of course all the reading aloud is done from a service, not activity, because a user may want to close my activity, or even turn off screen, and still listen. I would gladly post more technical details, but don't know which ones are relevant.
I tried searching for any combination of terms "TalkBack saying 'service' repeatedly", but cannot find anything relevant. My users who contacted me about this could not find either any setting in TalkBack app to make it stop saying this. Could anyone shed some light on this issue?
I found the reason for my problem, part of it was my own app code, and part just confusing behavior of Android system and TalkBack on different devices. Here is what was happening:
The app, #Voice Aloud Reader, reads text loaded into it (web pages, docs, books) and highlights the sentence it reads aloud. On each change of sentence it updates progress, both on its own screen if visible, and in the notification. The notification update code is pretty old, from Android 4 days. I did not know then how to update the content of notification, it seemed to me that the only way to update it, after using NotificationBuilder to update content, was to call in my service again:
startForeground(/* id: */ 1000, myNotifBuilder.build());
It worked well for years, also under TalkBack, no problems. Even today on at least 5 test devices I have with Android 5 to 9 and with emulators, TalkBack activated, it works correctly. But some users reported that upon reading each new sentence (progress update), TalkBack says "Service #Voice". I finally updated the code as follows, and my users report that the problem is solved:
if (newNotification) {
startForeground(/* id: */ 1000, myNotifBuilder.build());
}
else {
NotificationManagerCompat.from(this).notify(1000, myNotifBuilder.build());
}
I doubt that this knowledge will help many people, now notifications are documented better and there is a clear "Update notification" chapter that explains how to do this correctly in Google documents for developers.
I bet it's announcing the app name on orientation changes each time the MainActivity is created.
SO link
I tried really really hard (scanning/trying sample code, reading docs …) but, haven’t been able to figure out how swap out BIND_LISTENER for the new-and-improved CapabilityApi/CapabilityClient scheme.
I recently got a Ticwatch E (from kickstarter) & its running AW 2.0. I came to AW from a Garmin FR-230 & before that, a Pebble smartwatch. I developed similar watchfaces on the Garmin + Pebble platform & one function I included in both, was to vibrate when Bluetooth connectivity breaks (so basically, I don’t leave my mobile phone at home).
I ported my watchface to AW and it works fine w/ BIND_LISTENER in the manifest pointing to my WearableListenerService class - i.e. see logs & pop-up notification. However, I get errors when I try to publish to google playstore `cause BIND_LISTENER is deprecated.
I tried changing the intent-filter to CAPABILITY_CHANGED (I was hoping it was as simple as that). I tried adding onCapabilityChanged() to this WearableListenerService – nothing/no log events.
The links below are to my watchface & the “working” source code on GitHub (w/ BIND_LISTENER). Check-out the manifest + the listener class.
Most of the examples I’ve seen are for activities or for passing data around between wear + mobile – I just want an alert when connectivity changes. A connectivity icon pops up on my watch when BT is gone so, it’s gotta be possible to get an alert.
Newbie Android Wear developer & struggling with the documentation. Appreciate an explicit example, if possible.
https://android-developers.googleblog.com/2016/04/deprecation-of-bindlistener.html
https://play.google.com/store/apps/details?id=com.antonio_asaro.www.marvin_watchface
https://github.com/antonioasaro/Android-Marvin_Watchface
Thanks,
--Antonio
I have been using Google CloudPrint since December, and suddenly (sometimes, mostly when the networks is slow) when printing, it keeps printing.
I am using this configuration: Android Phone, my App creates a print job with ticket via Google CloudPrint, the android notification center displays the print job "Printing" (as in sending...), the Google CloudPrint receives the task, and prints it with the printer associated, then, normally, it removes the print job from the notification center. and thats all.
Now, it stays in the notification center... for ever, even if you cancel, it already sent a lot of print jobs (they are slow to appear on the GoogleCloud panel).
Is there a bug with Google CloudPrint or is a problem with my (probably outdated now) code?
I know is Beta, and that, but i neither find documentation, known bugs, or anything at all.
If you can guide me in solving this problem...
(This is the code i use to send the intent)
PrintHelper photoPrinter = new PrintHelper(Context);
photoPrinter.setScaleMode(PrintHelper.SCALE_MODE_FIT);
photoPrinter.printBitmap("print job", bitmap);
I had the same issue on a Samsung Galaxy Tab 4. I uninstalled Cloud Print and then reinstalled. Fixed the issue.