Java Android解析推送通知功能不会在状态栏上显示消息
我正在使用parse 1.8.2进行pusch通知,在状态栏上显示notyfication时遇到问题。 一切正常,但无法在状态栏上显示消息 这是我的舱单Java Android解析推送通知功能不会在状态栏上显示消息,java,android,parse-platform,Java,Android,Parse Platform,我正在使用parse 1.8.2进行pusch通知,在状态栏上显示notyfication时遇到问题。 一切正常,但无法在状态栏上显示消息 这是我的舱单 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.sklep.parse5000" > <
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sklep.parse5000" >
<uses-sdk android:minSdkVersion="16"
android:targetSdkVersion="16"
android:maxSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.tutorials.pushnotifications.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission android:protectionLevel="signature"
android:name="com.example.sklep.parse5000.permission.C2D_MESSAGE" />
<uses-permission android:name="com.example.sklep.parse5000.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.example.sklep.parse5000.parseApplication">
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.parse.PushService" />
<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" />
<!--
IMPORTANT: Change "com.parse.tutorials.pushnotifications" to match your app's package name.
-->
<category android:name="com.example.sklep.parse5000" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.ParsePushBroadcastReceiver" 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" />
</intent-filter>
</receiver>
<!-- replace @drawable/push_icon with your push icon identifier -->
<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/ic_launcher"/>
</application>
</manifest>
MainActivity为空。我没有添加任何内容,只是空白项目。
请帮我处理这个状态栏
日志
在您的清单中,我看不到您的targetSdkVersion或MinSDK版本,在这种情况下,应用程序将使用sdk版本1作为默认版本, 但解析推送至少需要sdk api 9GingerBread,所以推送无法工作
这里有更多信息->您必须扩展ParsePushBroadcastReceiver,并覆盖OnPushOpen 下面的例子
public class Receiver extends ParsePushBroadcastReceiver
{
@Override
public void onPushOpen(Context context, Intent intent)
{
Intent mIntent = new Intent(context, Activity.class);
mIntent.putExtras(intent.getExtras());
mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
//if overriding onPushOpen, we have to manually track opened intent events
ParseAnalytics.trackAppOpenedInBackground(mIntent);
//start activity
context.startActivity(mIntent);
}
@Override
protected int getSmallIconId(Context context, Intent intent)
{
return R.drawable.push_notification_icon;
}
}
别忘了将此广播接收器添加到清单中。祝你好运 推送工作正常,但状态栏上不显示任何内容。Add sdk versjon change nothing.@user3818006是否正在通过解析网站发送推送消息?是否可以发布更新的清单和日志文件。现在一切都不起作用,我认为这不起作用,但唯一的问题是我无法在顶部栏上看到notyfication,在桌面屏幕上,在初始化parse PushService.setDefaultPushCallbackthis,MainActivity.class后添加此项;接受的答案可能会有所帮助->
01-29 22:10:00.383 16797-16797/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ getExtractedText on inactive InputConnection
01-29 22:12:55.647 16797-16797/com.example.sklep.parse5000 E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
01-29 22:12:55.647 16797-16797/com.example.sklep.parse5000 E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
01-29 22:13:14.297 17783-17787/com.example.sklep.parse5000 D/dalvikvm﹕ GC_CONCURRENT freed 274K, 15% free 9539K/11143K, paused 19ms+2ms, total 44ms
01-29 22:13:14.387 17783-17783/com.example.sklep.parse5000 I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
01-29 22:13:14.387 17783-17783/com.example.sklep.parse5000 W/dalvikvm﹕ VFY: unable to resolve virtual method 11516: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
01-29 22:13:14.387 17783-17783/com.example.sklep.parse5000 D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
01-29 22:13:14.387 17783-17783/com.example.sklep.parse5000 I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
01-29 22:13:14.387 17783-17783/com.example.sklep.parse5000 W/dalvikvm﹕ VFY: unable to resolve virtual method 11522: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
01-29 22:13:14.387 17783-17783/com.example.sklep.parse5000 D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
01-29 22:13:14.387 17783-17783/com.example.sklep.parse5000 I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
01-29 22:13:14.387 17783-17783/com.example.sklep.parse5000 W/dalvikvm﹕ VFY: unable to resolve virtual method 9187: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
01-29 22:13:14.387 17783-17783/com.example.sklep.parse5000 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
01-29 22:13:14.422 17783-17783/com.example.sklep.parse5000 I/dalvikvm﹕ Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
01-29 22:13:14.422 17783-17783/com.example.sklep.parse5000 W/dalvikvm﹕ VFY: unable to resolve virtual method 11519: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
01-29 22:13:14.422 17783-17783/com.example.sklep.parse5000 D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0007
01-29 22:13:14.427 17783-17783/com.example.sklep.parse5000 I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
01-29 22:13:14.427 17783-17783/com.example.sklep.parse5000 W/dalvikvm﹕ VFY: unable to resolve virtual method 417: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
01-29 22:13:14.427 17783-17783/com.example.sklep.parse5000 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
01-29 22:13:14.427 17783-17783/com.example.sklep.parse5000 I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
01-29 22:13:14.432 17783-17783/com.example.sklep.parse5000 W/dalvikvm﹕ VFY: unable to resolve virtual method 439: Landroid/content/res/TypedArray;.getType (I)I
01-29 22:13:14.432 17783-17783/com.example.sklep.parse5000 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
01-29 22:13:14.612 17783-17783/com.example.sklep.parse5000 D/libEGL﹕ loaded /system/lib/egl/libEGL_mali.so
01-29 22:13:14.617 17783-17783/com.example.sklep.parse5000 D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_mali.so
01-29 22:13:14.622 17783-17783/com.example.sklep.parse5000 D/libEGL﹕ loaded /system/lib/egl/libGLESv2_mali.so
01-29 22:13:14.627 17783-17783/com.example.sklep.parse5000 D/﹕ Device driver API match
Device driver API version: 10
User space API version: 10
01-29 22:13:14.627 17783-17783/com.example.sklep.parse5000 D/﹕ mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Thu Oct 25 08:43:05 KST 2012
01-29 22:13:14.652 17783-17783/com.example.sklep.parse5000 D/OpenGLRenderer﹕ Enabling debug mode 0
01-29 22:13:14.697 17783-17787/com.example.sklep.parse5000 D/dalvikvm﹕ GC_CONCURRENT freed 289K, 14% free 9755K/11335K, paused 13ms+2ms, total 35ms
01-29 22:13:15.142 17783-17783/com.example.sklep.parse5000 D/com.parse.push﹕ successfully subscribed to the broadcast channel.
01-29 22:13:18.382 17783-17787/com.example.sklep.parse5000 D/dalvikvm﹕ GC_CONCURRENT freed 385K, 15% free 9823K/11527K, paused 12ms+12ms, total 44ms
01-29 22:13:25.717 17783-17783/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
01-29 22:13:25.717 17783-17783/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
01-29 22:13:25.722 17783-17783/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ getExtractedText on inactive InputConnection
01-29 22:13:33.982 17783-17783/com.example.sklep.parse5000 E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
01-29 22:13:33.982 17783-17783/com.example.sklep.parse5000 E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
01-29 22:14:21.462 17783-17783/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
01-29 22:14:21.462 17783-17783/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
01-29 22:14:21.462 17783-17783/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ getExtractedText on inactive InputConnection
01-29 22:14:21.462 17783-17783/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
01-29 22:14:21.467 17783-17783/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
01-29 22:14:21.467 17783-17783/com.example.sklep.parse5000 W/IInputConnectionWrapper﹕ getExtractedText on inactive InputConnection
public class Receiver extends ParsePushBroadcastReceiver
{
@Override
public void onPushOpen(Context context, Intent intent)
{
Intent mIntent = new Intent(context, Activity.class);
mIntent.putExtras(intent.getExtras());
mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
//if overriding onPushOpen, we have to manually track opened intent events
ParseAnalytics.trackAppOpenedInBackground(mIntent);
//start activity
context.startActivity(mIntent);
}
@Override
protected int getSmallIconId(Context context, Intent intent)
{
return R.drawable.push_notification_icon;
}
}