我有一个应用程序,用户可以在其中通过SDK相互调用。一切正常。我只需要能够关闭fabebook和whatsapp之类的电话。即使应用程序完全关闭,它也应该能够启动特定活动。我遵循了一些stackoverflow问题,并尝试使用通知接收器,但它不起作用。
NotificationReceiver:
public class NotificationReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent intentNotification = new Intent();
intentNotification.setAction("com.start.app");
context.sendBroadcast(intentNotification);
}
}
清单:
<receiver
android:name=".Notifications.NotificationReceiver"
android:enabled="true"
android:exported="false"></receiver>
答案 0 :(得分:0)
您到底在寻找什么.. 这可以通过创建广播接收器类并在接收到消息时发送广播来完成,并且在广播接收器上的onReceive方法调用您要打开的特定活动。 不要忘记在清单中添加接收者 未经测试,但我认为它将起作用。