问题描述
我正在尝试从 one-signal android 扩展服务启动 Activity,但是当通知通过 ANR 到达我的应用时,我没有从后台启动 Activity。 谁能告诉我我错过了什么。
public class NotificationExtenderExample extends NotificationExtenderService {
@Override
protected boolean onNotificationProcessing(OSNotificationReceivedResult receivedResult) {
OverrideSettings overrideSettings = new OverrideSettings();
overrideSettings.extender = new NotificationCompat.Extender() {
@Override
public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {
//Force remove push from Notification Center after 30 seconds
builder.setTimeoutAfter(30000);
// Sets the icon accent color notification color to Green on Android 5.0+ devices.
builder.setColor(new BigInteger("FFed2202",16).intValue());
builder.setContentTitle(receivedResult.payload.title);
builder.setContentText(receivedResult.payload.body);
return builder;
}
};
OSNotificationdisplayedResult displayedResult = displayNotification(overrideSettings);
return false;
}
public void onCreate() {
super.onCreate();
Intent intent = new Intent(this,MainActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra("route","/");
this.startActivity(intent);
android.os.Debug.waitForDebugger();
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)