Pop up state directly from coldstart

↘锁芯ラ 提交于 2019-12-12 10:53:01

问题


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


回答1:


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

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

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".



来源:https://stackoverflow.com/questions/38252461/pop-up-state-directly-from-coldstart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!