直接从coldstart弹出状态 [英] Pop up state directly from coldstart

查看:137
本文介绍了直接从coldstart弹出状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用应用构建了一个离子骨架。它是使用 Peer JS 构建的,我需要应用程序在我的对等端收到来电时快速从冷启动打开状态有点像电话应用程序在我们接到电话时打开来电活动。

I've built a Cordova app using the ionic framework. It is build using Peer JS and i need the app to open a state from cold start quickly whenever my peer receives an incoming call, kind of like the phone app opens the incoming call activity when we receive a call.

目前我正在使用离子推送通知在点击通知时打开状态,但这需要太长时间并从启动屏幕开始加载。

Currently I'm using ionic push notifications to open the state on click of the notification but that takes too long and loads from the splash screen onwards.

是有一种方法可以快速打开我的状态,包含接收调用代码快速进入前台

Is there a way to kind of pop open my state containing the receive call code into the foreground quickly

推荐答案

对于Cordova,黑客我想出了,

For Cordova, the hack that i came up with was,

首先,将来电代码分成带有所需javascript代码的html页面。

First, separate the incoming call code into a html page with the required javascript code.

接下来,发送一个包含特定有效负载的通知,然后在phonegap推送插件的onRecieve方法中,检查有效负载,如果它与特定的有效负载匹配,如果应用程序被杀死,我使用意图打开主要包含cordova webview的活动,我根据意图在这里加载html页面。

Next, send a notification with a specific payload, then in the onRecieve method in the phonegap push plugin, I check the payload, if it matches the specific payload and if the app is killed, i use an intent to open the main activity which contains the cordova webview, I load the html page here based on the intent.

这使得它看起来好像应用程序弹出打开。

This makes it appear as if the app "pops open".

这篇关于直接从coldstart弹出状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆