TEL:400-8793-956
当前位置:程序、服务器

推送通知测试成功,但未在模拟器中显示推送通知

提问者: 近期获赞: 浏览人数: 发布时间:2021-03-06 09:58:29

 问:就像标题所暗示的,推入测试是成功的。但是它没有在状态栏中显示通知。任何帮助表示赞赏,谢谢。哦,我将genymotion用作仿真器,并使用api 19(4.4.4)运行nexus 4。

 
RibbitApplication.java
 
包 com.teamtreehouse.ribbit ; 
导入android.app.Application ; 导入com.parse.Parse ; 导入com.parse.ParseInstallation ; 公共类RibbitApplication扩展应用{ @覆盖公共无效的onCreate (){超。onCreate (); 解析。初始化(此,“xPvxj9cx2bD4PDv1Doxt8pZFIW47nG70SwVzhlk3” ,“xQS0mVnFFBD5gTN2kf6op0cxZ6Upk3D8wVMfHLri” ); ParseInstallation 。
 
        getCurrentInstallation ()。saveInBackground (); 
} }    
 
Build.gradle
 
    Apply插件:'com.android.application'android
 {
 compileSdkVersion 19
     buildToolsVersion '23 .0.0'defaultConfig
     {
         applicationId“ com.teamtreehouse.ribbit”
         minSdkVersion 14
         targetSdkVersion 19
     }
     buildTypes {
         release {
             minifyEnabled false
             proguardFiles getDefaultProguardFile('proguard-android.txt '),'proguard-rules.txt'
         }
     }
 }
依赖项{
    编译fileTree(dir:'libs',包括:['* .jar'])
    编译'com.parse.bolts:bolts-android:1. +'
    编译'com.parse.bolts:
bolts-android:1. +'
 
    编译fileTree(dir:'libs',包括:'Parse-*。jar')
    编译'com.android.support:support-v4:19.1.0'
    编译文件('libs / commons-io-2.4.jar')
    编译文件('libs / Parse-1.10.3.jar')
    编译文件('libs / picasso-2.1.1.jar')
 }
AndroidManifest.xml
 
<?xml version =“ 1.0” encoding =“ utf-8”?> 
<清单 xmlns:android = “” http://schemas.android.com/apk/res/android“ 
package = ” com.teamtreehouse.ribbit“ android :versionCode = “ 1” android:versionName = “ 1.0” > <uses-sdk android:minSdkVersion = “ 14” android:targetSdkVersion = “ 19” /> <uses-permission android:name = “” android.permission.INTERNET“ / > <uses-permission android:name = “” android.permission.ACCESS_NETWORK_STATE“ /> <uses-permission android:name = “” android.permission.WRITE_EXTERNAL_STORAGE“ />    
 
      
    包名称+“ .permission.C2D_MESSAGE”。  
    -> <权限      
 
     android:protectionLevel = “ signature” 
android:name = “ com.teamtreehouse.ribbit.permission.C2D_MESSAGE” /> <uses-permission android:name = “” com.teamtreehouse.ribbit.permission.C2D_MESSAGE“ /> <应用程序android:name = “ com.teamtreehouse.ribbit.RibbitApplication” android:allowBackup = “ true” android:icon = “ @ drawable / ic_launcher” android:label = “” @ string / app_name“ android:theme = ”“ style / Theme.Ribbit” > <activity android:name = “ com.teamtreehouse.ribbit.ui.MainActivity” android:label = “ @ string / app_name” android:screenOrientation =                 
            
            “肖像”  > 
<intent-filter> <action android:name = “ android.intent.action.MAIN” /> <category android:name = “” android.intent.category.LAUNCHER“ /> </ intent-filter> < / activity> <activity android:name = “ com.teamtreehouse.ribbit.ui.LoginActivity” android:label = “ @ string / title_activity_login” android:screenOrientation = “ portrait” > </ activity> <activity android:name = “” com .teamtreehouse.ribbit.ui.SignUpActivity“ android:label = ”@ string / title_activity_sign_up“ android:parentActivityName =            
 
            “ com.teamtreehouse.ribbit.ui.LoginActivity” 
android:screenOrientation = “纵向” > </ activity> <activity android:name = “” com.teamtreehouse.ribbit.ui.EditFriendsActivity“ android:label = ”“ @ string / title_activity_edit_friends” android:parentActivityName = “ com.teamtreehouse.ribbit.ui.MainActivity” android:screenOrientation = “纵向” > <元数据android:name = “” android.support.PARENT_ACTIVITY“ android:value = ”“ .ui.MainActivity” /> </ activity> <activity android:name = “” com。teamtreehouse.ribbit.ui.RecipientsActivity“ android:label =      
            “ @ string / title_activity_recipients” 
android:parentActivityName = “” com.teamtreehouse.ribbit.ui.MainActivity“ android:screenOrientation = ”“肖像” > <元数据android:name = “” android.support.PARENT_ACTIVITY“ android:value = ”“。 ui.MainActivity“ /> </ activity> <activity android:name = ” com.teamtreehouse.ribbit.ui.ViewImageActivity“ android:label = ”“ @ string / title_activity_view_image” android:parentActivityName = “” com.teamtreehouse.ribbit.ui。 MainActivity“ android:screenOrientation = ” portrait“ > <元数据android:name = “” android.support.PARENT_ACTIVITY“            
 
                android:value = “” .ui.MainActivity“  /> 
</ activity> <service android:name = ”“ com.parse.PushService” /> <receiver android:name = “” com.parse.ParsePushBroadcastReceiver“ android:exported = ”“ false “ > <意图过滤器> <动作android:name = ” com.parse.push.intent.RECEIVE“ /> <动作android:name = ”“ com.parse.push.intent.DELETE” /> <动作android:name = “ com.parse.push.intent.OPEN” /> </ intent-filter> </ receiver> <接收器android:name = “ com.parse.GcmBroadcastReceiver”        
 
                  android:permission = “ com.google.android.c2dm.permission.SEND” > 
<意图过滤器> <action android:name = “” com.google.android.c2dm.intent.RECEIVE“ /> <action android:name = “ com.google.android.c2dm.intent.REGISTRATION” /> <!-                  重要:更改“ com.parse.starter”以匹配您应用的程序包名称。                -> <category android:name = “ com.teamtreehouse.ribbit” /> </ intent-filter> </ receiver> </ application> </ manifest>    
 
 
答:现在从你上面提供的代码还是看不出来任何问题的。   
上一篇: 代码检查器抱怨我没有在图库中设置列表项的颜色
下一篇: 什么是未使用的l值?