Xtifyを使用してAndroidアプリにプッシュ通知を送信していますが、Xtify SDKforGCMに問題があります
プッシュ通知がXtifyから送信され、ユーザーがそれをクリックすると、アプリのメインアクティビティが開きますが、特定のアクティビティを開くために必要です。どのように使用すればよいですか?
そしてここに私のManizest.xmlがあります
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Knockbook.CookingRecipes"
android:versionCode="2"
android:versionName="1.1" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<permission
android:name="com.Knockbook.CookingRecipes.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.Knockbook.CookingRecipes.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AdsActivity" />
<receiver android:name=".XtifyNotifier" >
<intent-filter>
<action android:name="com.xtify.sdk.NOTIFIER" />
</intent-filter>
</receiver>
<provider
android:name="com.xtify.sdk.db.Provider"
android:authorities="com.Knockbook.CookingRecipes.XTIFY_PROVIDER"
android:exported="false" />
<receiver android:name="com.xtify.sdk.c2dm.C2DMBroadcastReceiver" >
<intent-filter android:permission="com.google.android.c2dm.permission.SEND" >
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.Knockbook.CookingRecipes" />
</intent-filter>
<intent-filter android:permission="com.google.android.c2dm.permission.SEND" >
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.Knockbook.CookingRecipes" />
</intent-filter>
</receiver>
<receiver android:name="com.xtify.sdk.NotifActionReceiver" />
<receiver android:name="com.xtify.sdk.wi.AlarmReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="com.xtify.sdk.location.LocationUpdateService" />
<service android:name="com.xtify.sdk.c2dm.C2DMIntentService" />
<service android:name="com.xtify.sdk.alarm.MetricsIntentService" />
<service android:name="com.xtify.sdk.alarm.TagIntentService" />
<service android:name="com.xtify.sdk.alarm.RegistrationIntentService" />
<service android:name="com.xtify.sdk.alarm.LocationIntentService" />
</application>
これもXtifyNotifierです
package com.Knockbook.CookingRecipes;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.PowerManager;
import android.sax.StartElementListener;
import android.util.Log;
import com.xtify.sdk.NotifActionReceiver;
import com.xtify.sdk.NotificationsUtility;
import com.xtify.sdk.api.NotificationsPreference;
import com.xtify.sdk.api.XtifyBroadcastReceiver;
import com.xtify.sdk.api.XtifySDK;
public class XtifyNotifier extends XtifyBroadcastReceiver {
@Override
protected void onC2dmError(Context arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
protected void onMessage(Context context, Bundle bundle) {
Log.d("XRecipes", "enter on Message");
if(bundle !=null){
String key = bundle.getString("key1");
if (key != null) {
Log.d("VVVVVVVVV ", key);
}
}
generateNotification(context, "zzzzz", "M<MMMMM");
}
@Override
protected void onRegistered(Context arg0) {
// TODO Auto-generated method stub
}
private static void generateNotification(Context context, String title,
String message) {
int icon = R.drawable.ic_launcher;
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, title,
System.currentTimeMillis());
Intent notificationIntent = new Intent(context, AdsActivity.class);
// set intent so it does not start a new activity
notificationIntent.putExtra("message", message);
notificationIntent.putExtra("title", title);
PendingIntent intent=PendingIntent.getActivity(context, 0,
notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT );
notification.setLatestEventInfo(context, title, message, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, notification);
}
}
注:2つの通知が表示されます。1つはXtify SDKによって生成され(通知によって開きたいアクティビティを開かない)、もう1つはgenerateNotification(context、 "zzzzz"、 "M