package com.movim.movim;

import android.app.Activity;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.webkit.JavascriptInterface;
import android.webkit.PermissionRequest;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class VisioActivity extends Activity {
    private WebView webview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().requestFeature(Window.FEATURE_NO_TITLE);

        setTheme(R.style.SplashTheme);
        setContentView(R.layout.activity_visio);

        String url = getIntent().getStringExtra("url");

        webview = (WebView) findViewById(R.id.visioview);

        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setDomStorageEnabled(true);
        webview.getSettings().setMixedContentMode(0);

        if (Build.VERSION.SDK_INT >= 21) {
            getWindow().setNavigationBarColor(Color.parseColor("#000000"));
        }

        webview.addJavascriptInterface(this, "Android");
        webview.setWebChromeClient(new WebChromeClient() {
            public void onCloseWindow(WebView view){
                super.onCloseWindow(view);
                finishAndRemoveTask();
            }

            @Override
            public void onPermissionRequest(final PermissionRequest request) {
                request.grant(request.getResources());
            }
        });

        webview.setWebViewClient(new WebViewClient() {
            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                webview.loadUrl("file:///android_asset/error.html");
            }

            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                webview.loadUrl(url);
                return true;
            }
        });

        webview.loadUrl("https://" + url);
    }

    @JavascriptInterface
    public void closePopUpWebview() {
        this.finishAndRemoveTask();
    }
}
@@ -48,16 +48,154 @@
 tivity;%0A
+import android.app.Notification;%0Aimport android.app.NotificationManager;%0Aimport android.app.PendingIntent;%0Aimport android.content.Intent;%0A
 import a
@@ -217,16 +217,16 @@
 .Color;%0A
-
 import a
@@ -268,16 +268,66 @@
 Bundle;%0A
+import android.support.v4.app.NotificationCompat;%0A
 import a
@@ -1550,35 +1550,23 @@
         
-finishAndRemoveTask
+endCall
 ();%0A    
@@ -2220,24 +2220,1289 @@
 ://%22 + url);
+%0A%0A        String channelId = %22channel-movim%22;%0A        String groupId = %22movim%22;%0A%0A        /* Persistent notification */%0A        NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);%0A%0A        Intent i = new Intent(this, VisioActivity.class);%0A        i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP %7C Intent.FLAG_ACTIVITY_CLEAR_TOP);%0A%0A        PendingIntent pi = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);%0A%0A        Notification notification = new NotificationCompat.Builder(this, channelId)%0A                .setSmallIcon(R.drawable.ic_stat_name)%0A                .setOngoing(true)%0A                .setContentTitle(%22Call%22)%0A                .setContentText(%22%E2%80%A6in progress%22)%0A                .setContentIntent(pi)%0A                .setLights(Color.parseColor(%22#3F51B5%22), 1000, 5000)%0A                .setGroup(groupId)%0A                .build();%0A        notificationManager.notify(%22call%22, 0, notification);%0A    %7D%0A%0A    protected void onDestroy() %7B%0A        super.onDestroy();%0A        NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);%0A        notificationManager.cancel(%22call%22, 0);%0A    %7D%0A%0A    private void endCall() %7B%0A        this.finishAndRemoveTask();
 %0A    %7D%0A%0A    
@@ -3573,35 +3573,23 @@
    this.
-finishAndRemoveTask
+endCall
 ();%0A    

Add a persistent notification for the call