我正在使用parse.com将推送通知发送到我的应用。一切都工作正常,直到我决定更改我的应用程序包名称。在我更改了我的Android应用程序包名称后,我的应用程序无法从parse.com接收推送通知。
我已经在google playstore上发布了我的应用。请问有办法解决这个问题吗?感谢。
这是我的manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.owatech.uccsrc"
android:versionCode="1"
android:versionName="1.0.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<permission android:name="com.owatech.uccsrc.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.owatech.uccsrc.permission.C2D_MESSAGE" />
<application
android:name="com.owatech.uccsrc.NotificationParseRegister"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppBaseTheme">
<activity
android:label="@string/app_name"
android:name="com.owatech.uccsrc.WelcomeScreen" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Welcome Home Screen Activity -->
<activity
android:label="@string/app_name"
android:name="com.owatech.uccsrc.DashBoardActivity">
</activity>
<!-- News Feed Activity -->
<activity
android:label="@string/news_feed"
android:name="com.owatech.uccsrc.NewsFeedActivity"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity"
android:icon="@drawable/newsfeed">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity" />
</activity>
<!-- Notification Activity -->
<activity
android:label="@string/notifications"
android:name="com.owatech.uccsrc.Notification"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity"
android:icon="@drawable/notifications">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity" />
</activity>
<!-- Single Notification Activity -->
<activity
android:label="@string/notification"
android:name="com.owatech.uccsrc.SingleNotification"
android:parentActivityName="com.owatech.uccsrc.Notification"
android:icon="@drawable/notifications">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.Notification" />
</activity>
<!-- Constitution Activity -->
<activity
android:label="@string/src_constitution"
android:name="com.owatech.uccsrc.Constitution"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity"
android:icon="@drawable/constitution">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity" />
</activity>
<!-- Constitution Details Activity -->
<activity
android:name="com.owatech.uccsrc.ConstitutionDetails"
android:parentActivityName="com.owatech.uccsrc.Constitution"
android:icon="@drawable/constitution">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.Constitution" />
</activity>
<!-- History Activity -->
<activity
android:label="@string/history"
android:name="com.owatech.uccsrc.History"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity"
android:icon="@drawable/history">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity" />
</activity>
<!-- SRC COMMITTEE Activity -->
<activity
android:label="@string/committees"
android:name="com.owatech.uccsrc.SrcCommittees"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity"
android:icon="@drawable/committee">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity"
/>
</activity>
<!-- SRC COMMITTEE DETAILS Activity -->
<activity
android:name="com.owatech.uccsrc.CommitteeDetails"
android:parentActivityName="com.owatech.uccsrc.SrcCommittees"
android:icon="@drawable/committee">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.SrcCommittees" />
</activity>
<!-- ABOUT SRC Activity -->
<activity
android:label="@string/aboutSRC"
android:name="com.owatech.uccsrc.AboutSRC"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity" />
</activity>
<!-- Settings Activity -->
<activity
android:theme="@android:style/Theme.Dialog"
android:label="Settings and Preferences"
android:name="com.owatech.uccsrc.Settings"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity" />
</activity>
<!-- STUDENTS PORTAL Activity -->
<activity
android:label="Student Portal"
android:name="com.owatech.uccsrc.StudentPortal"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity" />
</activity>
<!-- Src Executives Activity -->
<activity
android:label="SRC Executives"
android:name="com.owatech.uccsrc.SrcExecutives"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity"
android:icon="@drawable/executives">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity" />
</activity>
<!-- Online Constitution Activity -->
<activity
android:label="SRC Constitution"
android:name="com.owatech.uccsrc.OnlineConstitution"
android:parentActivityName="com.owatech.uccsrc.DashBoardActivity"
android:icon="@drawable/constitution">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.owatech.uccsrc.DashBoardActivity" />
</activity>
<!-- Service -->
<service android:name="com.parse.PushService" />
<receiver android:name="com.owatech.uccsrc.ParsePushReciverNotifications"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
<action android:name="com.parse.starter.NEW_NOTIF" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.owatech.uccsrc" />
</intent-filter>
</receiver>
</application>
</manifest>
答案 0 :(得分:1)
我遇到了同样的问题。我更改了包名后,即使它在解析推送通知仪表板上显示“已发送”,也无法接收推送通知。后来我意识到解析正在使用FCM(Firebase Cloud Messaging)来实现推送通知。我有一个FCM发件人ID和服务器密钥,这是我在firebase上创建项目并向该项目添加应用程序后得到的。在将应用程序添加到firebase项目时,我添加了应用程序的包名称。因此,当我更改我的包名称时,我的应用程序与firebase项目上的应用程序之间的连接将丢失。这就是为什么我没有收到通知。
因此,解决方案是您必须在firebase上创建一个新项目,并使用新包名称向该项目添加新应用程序。然后,您将获得新的Sender Id和Server密钥,您必须将其替换为较旧的Sender Id和Server Key。另一种解决方案是将新的包名称添加到现有的firebase项目中。
我为我做了第一个和它的工作。
答案 1 :(得分:0)
我遇到了同样的问题,发现我没有更新gradle文件以获得新的包名。这解决了问题