表盘配套应用未出现
Watchface companion app not appearing
问题: 我想在我的表盘上添加一个配套应用程序,我认为这很简单,因为添加 [=32= 的配置并不难] 穿。但我似乎无法在 android wear app 中显示装备,因此我可以打开配套配置应用程序。不管我做什么。
我花了一段时间试图解决这个问题,但我真的不知道我做错了什么,我已经安装了 google 示例,它们显示了设置。其他人能看出到底做错了什么吗?
XML MANIFEST FOR COMPANION APP
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="archtectsproductions.linuxwatchface">
<!-- Required to act as a custom watch face. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- All intent-filters for config actions must include the categories
com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION and
android.intent.category.DEFAULT. -->
<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MobileConfig"
android:label="@string/app_name">
<intent-filter>
<action android:name="archtectsproductions.linuxwatchface.CONFIG_DIGITAL" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
GRADEL FOR MOBILE APP
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "archtectsproductions.watchfacelinuxterminal"
minSdkVersion 19
targetSdkVersion 26
versionCode 23
versionName "7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
provided 'com.google.android.wearable:wearable:2.1.0'
compile 'com.google.android.support:wearable:2.1.0'
wearApp project(':wear')
implementation 'com.google.android.gms:play-services-wearable:11.8.0'
}
JAVA FOR MOBILE CONFIG
package archtectsproductions.linuxwatchface;
import android.app.Activity;
import android.content.ComponentName;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.support.wearable.companion.WatchFaceCompanion;
import android.widget.TextView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.PutDataMapRequest;
import com.google.android.gms.wearable.PutDataRequest;
import com.google.android.gms.wearable.Wearable;
public class MobileConfig extends Activity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private GoogleApiClient mGoogleApiClient;
private String mPeerId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mobileconfiglayout);
mPeerId = getIntent().getStringExtra(WatchFaceCompanion.EXTRA_PEER_ID);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Wearable.API)
.build();
ComponentName name =
getIntent().getParcelableExtra(WatchFaceCompanion.EXTRA_WATCH_FACE_COMPONENT);
TextView label = (TextView) findViewById(R.id.label);
label.setText(label.getText() + " (" + name.getClassName() + ")");
}
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
}
@Override
protected void onStop() {
if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
mGoogleApiClient.disconnect();
}
super.onStop();
}
@Override
public void onConnected(Bundle bundle) {
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
}
我真的看不出我做错了什么? android Wear 应用程序中的小齿轮不会出现在图标顶部。但它适用于 google 示例。我复制了清单。其他人能看出我可能做错了什么吗?
如有任何帮助,我们将不胜感激。
所以我解决了我的问题,我基本上是一个没有正确阅读文档的白痴。我必须包括
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.FOOBAR.android.FOOBAR.watchface.CONFIG_HANDHELD" />
在我的穿着清单中。现在一切都很好。
因此,如果其他人遇到此问题,那就是解决方案。
问题: 我想在我的表盘上添加一个配套应用程序,我认为这很简单,因为添加 [=32= 的配置并不难] 穿。但我似乎无法在 android wear app 中显示装备,因此我可以打开配套配置应用程序。不管我做什么。
我花了一段时间试图解决这个问题,但我真的不知道我做错了什么,我已经安装了 google 示例,它们显示了设置。其他人能看出到底做错了什么吗?
XML MANIFEST FOR COMPANION APP
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="archtectsproductions.linuxwatchface">
<!-- Required to act as a custom watch face. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- All intent-filters for config actions must include the categories
com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION and
android.intent.category.DEFAULT. -->
<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MobileConfig"
android:label="@string/app_name">
<intent-filter>
<action android:name="archtectsproductions.linuxwatchface.CONFIG_DIGITAL" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
GRADEL FOR MOBILE APP
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "archtectsproductions.watchfacelinuxterminal"
minSdkVersion 19
targetSdkVersion 26
versionCode 23
versionName "7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
provided 'com.google.android.wearable:wearable:2.1.0'
compile 'com.google.android.support:wearable:2.1.0'
wearApp project(':wear')
implementation 'com.google.android.gms:play-services-wearable:11.8.0'
}
JAVA FOR MOBILE CONFIG
package archtectsproductions.linuxwatchface;
import android.app.Activity;
import android.content.ComponentName;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.support.wearable.companion.WatchFaceCompanion;
import android.widget.TextView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.PutDataMapRequest;
import com.google.android.gms.wearable.PutDataRequest;
import com.google.android.gms.wearable.Wearable;
public class MobileConfig extends Activity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private GoogleApiClient mGoogleApiClient;
private String mPeerId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mobileconfiglayout);
mPeerId = getIntent().getStringExtra(WatchFaceCompanion.EXTRA_PEER_ID);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Wearable.API)
.build();
ComponentName name =
getIntent().getParcelableExtra(WatchFaceCompanion.EXTRA_WATCH_FACE_COMPONENT);
TextView label = (TextView) findViewById(R.id.label);
label.setText(label.getText() + " (" + name.getClassName() + ")");
}
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
}
@Override
protected void onStop() {
if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
mGoogleApiClient.disconnect();
}
super.onStop();
}
@Override
public void onConnected(Bundle bundle) {
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
}
我真的看不出我做错了什么? android Wear 应用程序中的小齿轮不会出现在图标顶部。但它适用于 google 示例。我复制了清单。其他人能看出我可能做错了什么吗?
如有任何帮助,我们将不胜感激。
所以我解决了我的问题,我基本上是一个没有正确阅读文档的白痴。我必须包括
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.FOOBAR.android.FOOBAR.watchface.CONFIG_HANDHELD" />
在我的穿着清单中。现在一切都很好。 因此,如果其他人遇到此问题,那就是解决方案。