我正在Android中实现一个应用程序。我在使用我的华为手表2时遇到了问题。这个应用程序运行得很好,但我不明白为什么它没有出现在手表的应用菜单中。
去设置->应用程序和通知->信息应用程序,我看到了我的应用程序。
发生了什么,我该怎么解决呢?
这是我的Manifest.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.prova._poc">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.type.watch" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@android:style/Theme.DeviceDefault"
tools:ignore="GoogleAppIndexingWarning"
tools:targetApi="ice_cream_sandwich">
<service
android:name=".MyfirebaseMessagingService" android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<uses-library
android:name="com.google.android.wearable"
android:required="true" />
<!--
Set to true if your app is Standalone, that is, it does not require the handheld
app to run.
-->
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="true" />
<!-- [START fcm_default_channel] -->
<!-- [START fcm_default_channel] -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="gizmos"
android:scheme="example" />
</intent-filter>
</activity>
<activity android:name=".Splash">
<intent-filter>
<action android:name="Splash" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>发布于 2019-05-20 14:53:02
您的主要Activity清单条目是错误的。具体来说,要使它出现在任何安卓设备上的应用程序启动程序中,它需要一个如下所示的<intent-filter>元素:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>我不知道为什么会有所有其他的东西,但是如果您需要它,为它创建第二个<intent-filter>元素。您可以有几个意图--为给定的<activity>筛选器,匹配不同的意图--但是用于启动程序的过滤器应该只包含--仅--包含这里显示的action和category。
更多信息在这里:https://developer.android.com/guide/components/intents-filters.html
https://stackoverflow.com/questions/56221438
复制相似问题