Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个将 c2dm 消息发送到另一台设备的应用程序,我想知道在收到 c2dm 消息时如何启动某个活动或应用程序?我可以在 c2dm 消息中发送执行此操作的意图,还是有更好的方法来执行此操作?
将此代码放在您处理来自 C2DM 的传入消息的位置。
Intent myActivity = new Intent(context, MainActivity.class); myActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(myActivity);
请确保,您已在清单中声明您的活动。