クリックされた通知の要件: 通知のクリック時に IntentReceiver.java クラスを処理 (実行) してから、インテントを転送したい。
IntentReceiver.java(BroadcastReceiver のサブクラス) ---> Notification.java(アクティビティ) ---> メイン ダッシュボード(アクティビティ)
1.) 私のアプリケーションでは、"BroadcastReceiver" のサブクラスである別のクラス "IntentReceiver.java" があります。
2.) その後、「IntentReceiver.java」クラス内で、レイアウト画面のない「Notification.java」クラスに切り替え、データを操作してメイン ダッシュボードに切り替えます。
3.) このメイン ダッシュボードでは、操作後に "Notification .java" クラスからメイン ダッシュボードで (putExtra() を介して) 受信したさまざまなキーに代わって、さまざまなダイアログを処理します。
IntentReceiver.java クラスのコード :これは、各通知を処理する個別のクラスです。
public class IntentReceiver extends BroadcastReceiver {
Context ctx;
private static String PUSH_KEY_ALERT = "alert";
@Override
public void onReceive(Context context, Intent intent) {
this.ctx = context;
String alert = intent.getStringExtra(PUSH_KEY_ALERT);
Bundle extras = getResultExtras(true);
extras.putInt(PushIOManager.PUSH_STATUS, PushIOManager.PUSH_HANDLED_NOTIFICATION);
setResultExtras(extras);
}
}
マニフェスト構成:
<receiver android:name="com.DxS.android.push.IntentReceiver" > </receiver>
<activity android:name=".Notification">
<action android:name="com.DxS.android.NOTIFICATIONPRESSED" />
<category android:name="android.intent.category.DEFAULT" />
</activity>
<activity android:name=".dashboard"> </activity>
これが私の要求の流れです。それを行うための最良の方法を教えてください。前もって感謝します...