I'm trying to set up my application to respond to one of the system-provided voice actions .
By following the above mentioned link I should declare, within my android wear apk, an activity that has a very specific intent filter.
In my sample application i tried to "hook" on the "Set a timer" Voice action so my AndroidManifest.xml has the following code:
<activity android:name=".wear.MyActivity2">
<intent-filter>
<action android:name="android.provider.AlarmClock.ACTION_SET_TIMER" />
</intent-filter>
</activity>
I then bundled, signed and installed the app in my phone. I then verified that the app got installed in both my phone and the watch ( LG G Watch ).
After veryfiying that everything went right i tried to see if my app was listed as "option" for the "Set timer" voice action within the "Android Wear" app. => It didn't.
I then tried rebooting both the phone and the watch and ultimately i tried the "Refresh apps" button that is shown within the "Android Wear" -> "Settings" menu.
Nothing changed. It looks like i cannot make the "Android Wear" app aware of my app so that it listens for the desired voice action and acts accordingly.
Notes:
I tried also other voice actions ( Even the one provided as example in the link - Take a note )
I tried different permutations of reboot/resync
I double checked that the android wear app was the latest compiled
Both phone and wear app share the same package name
The Activity does nothing except showing the hello world layout...
Use this intent filter instead:
<intent-filter>
<action android:name="android.intent.action.SET_TIMER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
Related
I implemented a watch face with a configuration activity on the mobile device. The configuration activity works fine when launched from within the Android Wear app.
However, I'd like to create an extra icon that launches the configuration activity like a normal app, from outside Android Wear. When I simply implement the activity as a normal app in AndroidManifest, like below, it fails to communicate with the watch.
Ideally, the extra launcher should start the configuration activity together with the Android Wear app, if it's not running already.
<activity
android:label="Companion Configuration"
android:name=".ConfigActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
It's nothing to do with the launcher icon - or really anything on the phone side.
What you need is for your Wear app to launch when data is changed in your phone-side configuration activity, and that's all set up in the wearable app. It's well documented at https://developer.android.com/training/wearables/data-layer/events.html#Listen
In your case (since your watch app isn't running yet when the phone Activity is launched), you'll probably want to subclass WearableListenerService. This will get run by the system when data is changed on the phone, and you can do whatever is appropriate for your app when that happens.
I got this working by using the Wearable.DataApi instead of the Wearable.MessageApi
I had been using the Wearable.MessageApi to update watch from phone and that requires a peerid which i guess is generated by the wear app. I put a if/then statement to check if peerid is null and if so use the DataApi instead and works from inside the wear app and from app drawer
When I run my developed android wear app via Android studio, it normally installs in my watch and can be later launched via wear launcher. Not sure what could happen, my latest project does not appear as icon in the launcher anymore, despite I can see the app being launched and fully functional, but after the ambient mode, when the app is moved to the background, I cannot relaunch from the wear. The only way would be to launch it from Android Studio again. The app icon was deleted from watch and I cannot figure out why!
When I check the list of packages in the phone via ADB, I can see it listed, but it never appears among installed apps in the wear, and it did few days ago.
I have LG G Watch R with Android 5.1.1, Android Wear 1.3.0.2166028, and Android Studio 1.5.0/141.2422023
This is what I figured out by trying different manifest setups:
When providing the intent filter to start your main activity in the wear manifest as a combination of action.Main and action.TRACK category with mime type /running, the activity will not register in the launcher with an icon, only voice action OK GOOGLE START RUNNING will launch the activity.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="vnd.google.fitness.TRACK"/>
<data android:mimeType="vnd.google.fitness.activity/running"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
To get the icon back to the launcher I had to make a compromise of loosing the ability to start the main activity with the voice launcher.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /></intent-filter>
I have a Sony Smartwatch 2 and I am currently trying to develop an app for it on Android Studio, but I am facing a difficulty:
I want the user to be able to choose if he wants or not to use the smartwatch option, that means I dont want to have my app started only by the "Smart Connect" app. I would like to Launch my app as a normal app and, once the app is running, give the user the possibility of using the Smartwatch.
If I use one of Sony's sample projects as a base to my app, it automatically gets installed on "Smart Connect". By trying to add the Smart Extension Utils and Smart Extension API to my "common" app, I can't get it to work with the smartwatch 2.
How can I do it?
If I am understanding your question correctly you can still have your app launch as a normal app by creating a main activity and setting it in your manifest as the default launcher.
So for instance create your java class:
com.yourapp.package/MainActivity
Then update your manifest file:
<activity android:name=".MainActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I am developing an Android Wear biking app. I am trying to enable the "Ok Google, Start cycling" into my app. It works perfectly if I say it to the phone, but not to my Moto360. Also in the Android Wear app, I am unable to choose my app as the default for "Start bike ride" Any suggestions?
This is what I have in my manifest, and it is based off of Google's example.
<intent-filter>
<action android:name="vnd.google.fitness.TRACK" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.google.fitness.activity/biking"/>
</intent-filter>
I searched other similar questions but didn't find a result.
Thanks for your help
Providing a Wear app is a requirement for being listed in the available apps to register for a system provided voice intent on Android Wear and appear in the Android Wear application for choosing as the default for that voice action. Per the Adding Voice Capabilities training, you attach the appropriate <intent-filter> to an activity in your Wear app. One point of note if you aren't ready to provide a full Wear app is this section of the same page:
When users speak the voice action, your app can filter for the intent that is fired to start an activity. If you want to start a service to do something in the background, show an activity as a visual cue and start the service in the activity. Make sure to call finish() when you want to get rid of the visual cue.
In your case, your activity could just display a visual cue that you are launching something (say using a ConfirmationActivity with an OPEN_ON_PHONE_ANIMATION from the Wearable UI library) and then send a message to your phone app, which would then listen for that message using a WearableListenerService and start the bike ride on the phone, posting your notification.
Note that a full Wear app with more customization is going to be expected as many apps, such as Runtastic on Android Wear add quite a few more abilities that augment the standard experience. While not out yet, an upcoming release of Android Wear will be adding offline (i.e., without a phone) GPS support for Android Wear watches that have GPS ability (currently only the not yet released Sony Smartwatch 3) and of course those abilities will require a full Android Wear experience and cannot rely on a phone app (although details have not yet been released).
You need to add a launcher intent-filter to it; then, saying "OK Google, start [app name]" will start the app. The launcher filter is:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
I have an Android AIR application (developed with Flex SDK 4.5.1) for which I need to block the Home Button, as the app is used by patients in a hospital without supervision, i.e. it is crucial that they cannot leave the app.
It seems that the only way to hijack the Home Button is to be registered as the default launcher, so that your own app gets the focus when home is pressed. This is easily achieved in the manifest, such as:
<activity android:excludeFromRecents="false">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.HOME"/>
</intent-filter>
</activity>
Now the problem is: If I do quit the application, the original launcher should be made available to the user and I think the solution would be to just start the original launcher, but how should I do that? The original Android-way of "intents" is not available in AIR and the navigatetoURL() function seems to work only for special URIs, e.g. "market://.." launches the default market app, however, I need to execute an arbitrary application...
Edit: I am referring to a mobile Android App running in this case on an Archos tablet, but it could run on any Android device with AIR installed, such as a typical mobile phone like the HTC desire. With "home button" I am referring to the respective hardware button that allows the user to switch applications (or, to be more exact, to switch to a launcher app that typically shows all the apps as icons to tap on). This "home button" functionality I need to block, as the user should not be able to easily switch to another application.
This is probably a less useful answer but disabling device buttons sounds like something that should be handled at the OS layer and not at the Application layer. Might want to have a custom build of Android for this purpose.