0
我使用下面的接收来自parse.com推接收器打开一个新的应用程序每次
import android.content.Context;
import android.content.Intent;
import com.parse.ParsePushBroadcastReceiver;
import org.json.JSONException;
import org.json.JSONObject;
public class PushNotificationReceiver extends ParsePushBroadcastReceiver {
private String pushUrl;
@Override
public void onPushOpen(Context context, Intent intent) {
JSONObject json = null;
try {
json = new JSONObject(intent.getExtras().getString("com.parse.Data"));
pushUrl = json.getString("url").toString();
} catch (JSONException e) {
e.printStackTrace();
}
Intent i = new Intent(context, MainActivity.class);
i.putExtra("url", pushUrl);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
它的做工精细的推动。问题是,当我点击通知时,即使应用程序在当时打开,它也会再次打开应用程序。 请指教。
,我想FLAG_ACTIVITY_CLEAR_TASK和FLAG_ACTIVITY_CLEAR_TOP到位的新任务。但没有运气 – shahriar