可能重复:
注册活动时的"点"是什么
在所有Android示例中,活动,服务等的名称都以点开头:
<activity android:name=".MyActivity" />
Run Code Online (Sandbox Code Playgroud)
我忘了在所有Android项目中都这样做 - 但它们确实很完美.
我的问题:这个领先的点真的需要吗?
编辑:这是我的一个应用程序的一个小快照示例.这个程序很完美.它不使用限定名称,也不使用点:
<activity
android:exported="false"
android:name="Tankvorgaenge" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity android:name="Tankvorgangdetails" />
<activity android:name="Tankvorgangdetailsbearbeiten" />
<activity android:name="TankvorgangUebersicht" />
<activity android:name="Verbrauch" />
<service android:name="MyService" />
Run Code Online (Sandbox Code Playgroud) 我正在使用本教程使用Firebase实现推送通知,但我似乎无法弄明白.继续抛出错误:
FirebaseInstanceId: background sync failed: SERVICE_NOT_AVAILABLE, retry in 40s
Run Code Online (Sandbox Code Playgroud)
我创建了一个类扩展FirebaseMessagingService和onMessageReceived(..).我收到了数据.我在清单中注册了服务,如:
<!-- [START firebase_service] -->
<service android:name="notifications.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- [END firebase_service] -->
Run Code Online (Sandbox Code Playgroud)
我在我的应用的根文件夹中添加了最新的google-services.json.不过,我什么也没记录.
当然,我搜索到StackOverflow来检查类似的问题.显然,并不多.找到了这个,但是由于我仍然收到相同的消息,因此不是很有帮助.对我可能错过的事情的任何想法?
我试过检查我的设备是否运行PlayStore服务,确实它有:
public boolean isGooglePlayServicesAvailable() {
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
int status = googleApiAvailability.isGooglePlayServicesAvailable(getApplicationContext());
if (status != ConnectionResult.SUCCESS) {
if (googleApiAvailability.isUserResolvableError(status)) {
googleApiAvailability.getErrorDialog(MainActivity.this, status, 2404).show();
}
return false;
}
return true;
}
Run Code Online (Sandbox Code Playgroud)