0

我正在使用一台设备进行测试,并且从中获得了很多新的注册 ID。不是每次构建应用程序时,但有时。我不确定这笔交易是什么。如何让它使用相同的 id?这不是应该发生的事情吗?

显现

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="company.android.phone.TheApp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />
    
    <!-- for push notifications -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <!-- App receives GCM messages. -->
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <!-- GCM connects to Google Services. -->
    <uses-permission android:name="android.permission.INTERNET" /> 
    <!-- GCM requires a Google account. -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <!-- Keeps the processor from sleeping when a message is received. -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!-- For performance testing a trace file is saved to the SD card -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    <uses-permission android:name="android.permission.GET_TASKS" /> 
    
    <permission android:name="company.android.phone.TheApp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <uses-permission android:name="company.android.phone.TheApp.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    
    <supports-screens
        android:resizeable="true"
        android:smallScreens="false"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="false"
        android:anyDensity="true" />

    <application
        android:icon="@drawable/app_icon"
        android:label="@string/app_name" >
        <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" 
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="company.android.phone.TheApp" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="company.android.phone.TheApp" />
            </intent-filter>
        </receiver>
        <activity 
            android:name=".SplashActivity"
            android:theme="@style/Theme.Splash"
            android:screenOrientation="portrait"
            android:noHistory="true" >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:label="@string/app_name"
            android:windowSoftInputMode="stateVisible|adjustPan"
            android:name=".TheAppActivity"
            android:screenOrientation="portrait" >
        </activity>
        <activity 
            android:name=".MainActivity" 
            android:windowSoftInputMode="stateVisible|adjustPan"
            android:screenOrientation="portrait" />
        <activity android:name=".WebViewActivity" 
            android:windowSoftInputMode="stateVisible|adjustPan"
            android:screenOrientation="portrait" />
        <service android:name=".GCMIntentService" />
    </application>
</manifest>
4

1 回答 1

2

您无法保证您的注册 ID 始终与您的设备相同。

注册 ID 一直持续到 Android 应用程序明确取消注册,或者直到 Google 为您的 Android 应用程序刷新注册 ID。

有关更多信息,请查看此处“启用 GCM”:http: //developer.android.com/guide/google/gcm/gcm.html

于 2012-12-03T16:37:02.243 回答