I've read several other questions regarding this same topic however I am still at my wit's end trying to figure out how to get my Watchface to appear on my Android Wear device, let alone publish it to the Play Store.
The project has a mobile app which houses a blank activity and then the Wear app (Watchface) which houses the activity for the Watchface.
I've attempted the following
signing both Wear and mobile apks and installing then both on my phone (mobile app shows with blank activity but no Wear Watchface available on watch)
installing the signed Wear apk separately (also does not display as a selectable Watchface)
running the Wear Watchface in the Android Studio emulator (works)
making sure that the same permissions exist in both mobile and Wear manifests
ensuring that all project IDs match up and are the same
Any advice or help would be great.
Writing watch face to wear 1.x.x or 2.0 involves extending your Java class to The CanvasWatchFaceService class and registering your watch face in the manifest and also working with the CanvasWatchFaceService.Engine class.
You don't have to create an Activity you will have to create a view and inflate or mostly draw the view in “void onDraw(Canvas canvas, Rect bounds)”. You have to register the service in your manifest like as shown below.
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="#drawable/preview_face" />
<meta-data
android:name=
"com.google.android.wearable.watchface.preview_circular"
android:resource="#drawable/preview_face_circular" />
Also You have to have Wake lock permission
<uses-permission android:name="android.permission.WAKE_LOCK" />
we need to add a special intent filter with the goal that watch.
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category
android:name=
"com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
It will be usual signed android apk to publish within playstore no much of difference.
Also there are plenty of resources that will get you started like medium blogs and reddit blogs and so on.
Check this book for more information on Wear : Android wear Projects
After much digging, I was able to get to the solution.
In order for a watch face or a wear apk to be moved on the watch for debugging purposes, one must ensure the following
Ensure all of these items are met in addition to the following.
Turn on debugging in both the Android Wear application as well as on the watch itself. (Debugging on the watch can be turned on by enabling developer options by tapping the build number) You would want to enable debugging over bluetooth
Your phone should also be plugged into to a computer that has adb and enable adb debugging on the device itself.
Typing adb-devices in Command Prompt will list all of the devices found
Connect the debugger to the watch by adb forward tcp:4444 localabstract:/adb-hub
adb connect 127.0.0.1:4444
Ensure that both target and Host are connected by opening the Android Wear companion app, tap settings and viewing the status message that appears under the bluetooth debugging toggle option. It should read Host: connected
Target: connected
adb-devices should now show both the phone and the watch. From here on you can use adb commands to push the wear apk to the watch.
Source
Related
My app has to adjust the screen brightness of the phone. To do so, I needed the following permission:
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
Android Studio shows the following error, when I hover over the permission:
Permission is only granted to system apps
But: the code still works when I upload it to my phone. Can somebody explain me why? Furthermore, I'd need to know, if this code will also work, if the user downloads the app from Google Play.
Is there a different approach to change the screen brightness?
I want to emulate an android device that has no in-built camera but I can't find a way to do this.
I have disabled the options for camera in the Android AVD Manager when creating a new emulator (and hardware), but the resulting emulator still has camera capabilities. I also tried using Genymotion emulator, but that doesn't even seem to have the option to disable camera.
Reason why:
I have this line in my manifest android:name="android.hardware.camera" that prevents a user that owns a device without camera from installing my app (Device not compatible). I want to add android:required="false" to it but that would mean I also have to implement some code for the case where the user accesses a camera function from my app while not having one on his device, and I need to test that.
Any suggestions are appreciated.
Try to switch Camera options Front and Back to None in device advanced settings.
So currently at my wits end for this issue.
I am trying to set my app as the default app launched when long pressing the Home button.
I am doing this by:
Setting Intent Filters in the manifest (I also experimented with adding MAIN and LAUNCHER action/category tags)
<action android:name="android.intent.action.ASSIST" />
<action android:name="android.intent.action.SEARCH_LONG_PRESS" />
<category android:name="android.intent.category.DEFAULT" />
Requesting the default app on an intent to allow users to change (there's also one for the Search Long Press action)
Intent intent = new Intent(Intent.ACTION_ASSIST);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
This approach works perfectly fine for devices running pre 6.0 software.
On post 6 devices the request is asked but the default assistant app is unchanged.
My app can be set as the default home app on post 6 devices perfectly fine when using these exact steps.
I'm unsure as to whether there's some kind of specific permission I'm missing or something. Nothing seems to work at all. The google app will always be used on long press. If I disable the google app then my app will run on long press.
Extra information: This is a kiosk app for business so I prefer to not have to disable the Google app for every single device this will go on. I don't mind if solutions are hacky as this is not going on the app store.
To implement your Assistant like app, the assistant app must provide an implementation of VoiceInteractionSessionService and VoiceInteractionSession.
It also requires the BIND_VOICE_INTERACTION permission.
See also:
Implementing Your Own Assistant
VoiceInteraction sample app
I have an Android app which is basically a Player. My users sometimes uses my app with a connected Bluetooth device like Speaker, Headphone, Car etc.
I have no special code to use or manage Bluetooth. But since Android OS managing it, my users able to use Bluetooth devices without any development from my side.
Lately i got some feedback that my app not playing well on Bluetooth devices and sound freezing or flickering. And they are saying they have no problems with other apps like Spotify, Youtube etc. Also i could not find any issue in my tests.
So any idea what problem can be? Is there anything i can implement to prevent it. Is there any way that i can reproduce that problem?
I don't know it will fix the issue. But for a try, can you please provide the following permission in your app's AndroidManifest.xml
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
What i need to do is to restrict all handset not able to download this application. This is just for all tablets. I added this code to my manifest as per the guidelines Link. here is the code :
<supports-screens
android:largeScreens="true"
android:normalScreens="false"
android:requiresSmallestWidthDp="600"
android:smallScreens="false"
android:xlargeScreens="true" />
But still i am able to install this application in my Samsung s3 and similer devices. How can i assure that it would not download and install in any handset only in tablets. Please reply if anybody have idea in the reference
Supports-screens or user-feature are just an indication for Google Play to allow or not a user to download your app but will not block you to install your app through the command line or android studio.