我正在开发一块表盘。该项目包括表面和手持应用程序,以报告移动电池。没有真正的伴侣应用程序 - 应用程序甚至隐藏在抽屉里。 我遇到的问题是,当我在手机上安装应用程序时,脸部未在手表上同步。 我几乎遵守了我在互联网上找到的所有内容:
值得一提的是,移动应用程序没有活动或其他东西。因此无法手动启动它。
有什么我想念的吗?从我的角度来看,没有理由不去工作......
移动舱单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="name.name" >
<uses-sdk android:minSdkVersion="18"
android:targetSdkVersion="21" />
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SET_TIME_ZONE"/>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" >
<!--android:theme="@style/AppTheme" >-->
<service android:name="name.name.BatteryListener"
android:permission="android.permission.BIND_WALLPAPER" >>
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<meta-data android:name="com.google.android.wearable.beta.app"
android:resource="@xml/wearable_app_desc"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
移动Gradle :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile "com.android.support:support-v4:21.0.2"
compile "com.android.support:support-v13:21.0.2"
compile "com.android.support:cardview-v7:21.0.2"
compile "com.google.android.support:wearable:1.1.+"
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "20"
defaultConfig {
applicationId "name.name"
minSdkVersion 18
targetSdkVersion 21
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
佩戴清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="qualiss.qualissfacewatch" >
<uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="21" />
<uses-feature android:name="android.hardware.type.watch" />
<!-- Required to act as a custom watch face. -->
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SET_TIME_ZONE"/>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault">
<service
android:name="name.name.MyWatchFace"
android:label="Name"
android:permission="android.permission.BIND_WALLPAPER" >
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/preview_square"/>
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="@drawable/preview_circle" />
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.example.android.wearable.watchface.CONFIG_ANALOG" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="name.name.BatteryActivity">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
佩戴Gradle :
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
compile 'com.google.android.support:wearable:1.1.+'
compile 'com.google.android.support:wearable:1.1.0'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "20"
defaultConfig {
applicationId "name.name"
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}
}
两个Gradle文件都与Android Watch Face样本紧密匹配......我只是绝望了。
答案 0 :(得分:0)
检查手机和监视清单文件中是否具有相同的权限集。这是我在同样情况下的原因。
答案 1 :(得分:0)
你的磨损清单中有这个:
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.example.android.wearable.watchface.CONFIG_ANALOG" />
这看起来像是从示例代码中遗留下来的,并且很可能指向您的移动应用中不存在的Activity。这很可能会导致部署表盘出现问题。
尝试删除它并查看它是否有帮助。
答案 2 :(得分:0)
我已从磨损清单中删除了这两个:
>>> np.linalg.norm(E-C[intersectedPlaneIndex])
7.2440723159783182
>>> np.linalg.norm(e)
6.0470140356703537
对我来说,似乎正确的权限程序不应该是在移动设备和磨损清单中具有相同,而是在移动设备中继承磨损权限,而不是(也)反之亦然。
感谢您的帮助!
答案 3 :(得分:0)
在您的移动平台中...您需要包含此内容......
ComboBox x:Name="AccentColorsComboBox"
ItemsSource="{Binding AccentColors, Mode=OneWay}"
SelectedValuePath="Name"
DisplayMemberPath="Name"
SelectionChanged="SelectionChanged"
/>
<ComboBox x:Name="AppThemesComboBox"
ItemsSource="{Binding AppThemes, Mode=OneWay}"
SelectedValuePath="Name"
DisplayMemberPath="Name"
SelectionChanged="SelectionChanged"
>
</ComboBox>