How to specify no actions for android wear notifications? - wear-os

I have a couple actions for my notifications, however I don't want any of them available on android wear. I know I can specify a list of custom actions for android wear, but how do I specify none? (I've tried addActions with an empty list, but no luck - then it just shows all the actions)

I don't think this is possible in standard way. If you specify at least 1 action in WearableExtender then normal actions will be replaced with wearable actions, but as you've said - you want to have 0 wearable actions.
For me you have 2 solutions:
Go with the API design post alternative versions of actions with your WearableExtender. If really any of phone actions cannot be used on watch maybe you can think of anything else that would be useful. It won't hurt user to be able to perform any action from watch. Of course if that makes sense in your case.
If you want to "hack" it a bit you can "clone" the notification and make them a part of the same group. If you would set one as a "group summary" that one will show up only on phone and other will be visible only on wearable. That way you have ability to setup completely independent set of actions.
Sample code:
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
// configure your builder without actions
builder.setGroup(GROUP_TAG);
builder.setGroupSummary(false);
notificationManager.notify(WEARABLE_NOTIFICATION_ID, builder.build());
// add some actions that will be visible only on phone
builder.addAction(...)
builder.addAction(...)
builder.setGroupSummary(true);
notificationManager.notify(PHONE_NOTIFICATION_ID, builder.build());

Related

Google Tag Manager isn't tracking mobile click to calls

I am trying to track clicks on the phone number on the website. After I set up the trigger using following settings:
Trigger Type: all elements;
Page URL: contains "tel:" ;
Click Text: contains "13";
With these settings, the trigger is firing correctly on the desktop but isn't working on mobile.
I tried to use only "Page URL"/"Text Only"/"Form Text"/"Form contains" as conditions for the trigger to fire, but all attempts are unsuccessful. I also tried to use "Just Links" as a trigger type but it's not helping.
I also tested the URL in different mobile browsers (chrome/safari) and emulator. With an emulator, the tag is firing correctly but it's not working on the
Please have a look at the preview to see the page and tracking I am talking about:
https://www.googletagmanager.com/start_preview/gtm?uiv2&id=GTM-T92J432&gtm_auth=MmNY2ZtOefQOp1Kce4yUFQ&gtm_preview=env-5&gtm_debug=x&url=https://lp.acfc.com.au/good-credit
I appreciate your advice on what is the problem and how it can be fixed.
Thanks!
Kirill
Actually, better way of doing this to set generic trigger in GTM, then you will be able to track any phones on your website:
1) Enable built-in variable Click Element (if you already have it, you can skip this step)
2) Create trigger, which will fire for all links which have tel:***** (it can be any phone).
CSS selector on the screenshot is a[href*="tel:"]
3) Create a tag, which will send data to GA
4) Check your events in GA.
Keep in mind that it might take a couple of hours to appear in Behaviour-> Events tab. Or you can check it immediately in Real Time -> Events tab
RESOLVED:
I just found out that in order to identify an event it is safer to look at how the data layer is changing after the action rather than on the "Variable" tab.
By doing so, you can see what data is actually going to google analytics, and it is more stable to use it as an ID for a trigger to fire.
In my case, I've had only elementURL that was pushed back to the datalayer. I used the parameter elementID equals "tel:xxxxxx" to make the tracker work. Hope it will help (just put your number instead of x).
Cheers!

How to make a Finder Sync Extension change badges in response to outside events

I have a Finder Sync Extension that will display a badge on a file based on the state of a local database. It's straightforward enough to query this database in the requestBadgeIdentifierForURL function, but what if I want the badge to change for a Finder item that's already visible if the state of that database has changed (which can be via a notification through any variety of mechanisms). The documentation (https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Finder.html) would seem to imply this is possible with this statement:
You might also want to track these URLs, in order to update their
badges whenever their state changes.
The only ways I can imagine this would be possible (and most seem wrong) would be:
call setBadgeIdentifier:forURL from another application that is aware of the change
Launch a thread in the init function of my extension which listens for notifications and calls setBadgeIdentifier:forURL when it receives them
Call some OS API that prompts Finder that the extension should be triggered via requestBadgeIdentifierForURL.
Only the last one seems feasible, and could be managed via the extension informing the outside resource what needs refreshing via the beginObservingDirectoryAtURL/endObservingDirectoryAtURL callbacks, but i don't know what mechanism could do this.

Branch.io: detect first install from Unity

Trying to detect the first install event from branch.io link (succesfully implement link creating and sharing). I am using Unity branch sdk. The feature i try to create:
user_1 creates and share link to user_2.
When user_2 opens the link and install app i need to reward both of them (with inner in-game coins)
So i succesfully implement the 1. but I cant understand how to detect is user_2 installs the app or simply open it. All data that comes from branch.io UniversalObject callback doesn't contain information that i need.
Which the correct way to detect the install from code?
Alex from Branch here.
The callback parameter you need is +is_first_session. This is one of the parameters returned when the Branch session is initiated each time your app opens (you can find all all these parameters here). If this returns true, then that device has just installed the app (instead of opening it).
However, note that when these parameters are returned, it's impossible to immediately determine if the user is new (what you want), the device is new (not what you want, since the reward could be given twice if the user has installed on multiple devices), or neither (the user deleted the app and reinstalled on the same device). You would probably want to hold off on actually awarding the referral points until after the user has logged in with some sort of unique ID.
Branch also has a built-in feature for tracking referral points that might be useful. That lets you configure all the rules using the dashboard UI instead of needing to do it programmatically inside your app.

Android MediaRouter

I try to build a Titanium module for Mediarouter (Chromecast). The standard solution for it is the use a MediaRouteSelector that opens a dialog with elements of android-support-mediarouter.jar. If I build a demo app by using the chromecast module then the aapt tries to resolve dependencies to appcompat-v7. But a module can only work with one res folder.
My question: is it possible the get a mediaroute without UI? I mean to ask the android and the system give me a collection of connected devices (name and id), I build an own dialog box and the result of users select calls a method to commect with this selected device. This solution would avoid the res conflict.
Here the repo: https://github.com/AppWerft/Ti.Chromecast/tree/master/android
Thanks
MediaRoute has nothing to do with the UI itself. You can initiate a discovery on the local network for the routes that satisfy your search criteria and then register to be notified when a matching route is found or dropped out, etc. If you want to show your own UI, you'd need to manage the list yourself, both in terms of bookkeeping, interactions and presentation. Look at our Android sender documentation or one of our Android sample apps (e.g. MediaRoute-Cast-Button sample) to get an idea.

Clean UI elements watchOS 2 after lock

When the app starts is Apple watchOS2 it calls:
awakeWithContext
Then, if you lock and unlock the app, the lifecycle calls:
willActivate
The problem that I have is that I cannot remove the UI elements (clean screen), without user see the "old" screen during 1 second.
From the Apple documentation:
didDeactivate:
-Do not use this method to modify your interface......Modifications can be made only during initialization of your interface controller and between calls to willActivate and this method.
but then in willActivate method:
.... Do not use this method to perform the initial setup of your interface.
I don't know what I have to do to "clean" the screen when the user locks the app.
Thanks for your time.
The answer from Apple:
Thank you for contacting Apple Developer Technical Support (DTS). Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.

Resources