9
Views
1
Comments
Solved
¨PWA apk not compatible with Firebase, adapt javascript
Question
Application Type
Reactive
Service Studio Version
10.0.1109.1
Platform Version
11.10.0.25600

Hello Good Morning

i have a apk that use pwa it is not compatible with cordova i can not use the firebase for mobile, i found in forge web analitics ,  but this solution work only  with  web block i can not use web block in my pwa apk, is ther a way to adapt a java script to solve this problem??

i am try this way


var head1 = document.getElementsByTagName('body')[0];


var script_src1= 'src="https://www.gstatic.com/firebasejs/8.2.1/firebase-app.js";';

var new_script1 = document.createElement('script');


var script_src2= 'src="https://www.gstatic.com/firebasejs/8.2.1/firebase-analytics.js";';

var new_script2 = document.createElement('script');



new_script1.type = 'text/javascript';

new_script1.src= script_src1;


new_script2.type = 'text/javascript';

new_script2.src= script_src2;



head1.appendChild(new_script1);

head1.appendChild(new_script2); 



var script_src3= 'firebase.initializeApp("");';

var new_script3 = document.createElement('script');


    


head1.appendChild(new_script3);  


but i have the following error :



Rank: #23665
Solution

i made a solution but i don't beliave is the best?? 

download 

"<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src='https://www.gstatic.com/firebasejs/7.15.4/firebase-app.js'></script>

<!-- TODO: Add SDKs for Firebase products that you want to use
     https://firebase.google.com/docs/web/setup#available-libraries -->
<script src='https://www.gstatic.com/firebasejs/7.15.4/firebase-analytics.js'></script>
upload to my proyect
load in my page