Integration on Webview/iFrame


  • Integration on a Website with iFrame
  • 
    <!DOCTYPE html>
    <html>
    
      <body>
        <iframe src="https://wwevents.fun" height="600px" width="500px" style="border:none;">
        </iframe>
      </body>
    
    </html>
    			


  • Costumizations through URL parameters
  • 
    	//Default endpoint call
    	https://wwevents.fun
    	
    	//Extra parameters
    	&city=lisboa //search by city name
    	&lat=38.7572458 //search by latitude and longitude
    	&lng=-9.1733044 //search by latitude and longitude
    	&since=03-07-2017 //Start date in format: DD-MM-3.0.1Y
    	&until=04-07-2017 //End date in format: DD-MM-3.0.1Y
    	
    	//Example of custom endpoint call
    	https://wwevents.fun/?lat=38.720176&lng=-9.139717
    	
    	//Filter by categories
    	//List of available categories: 
    	//Sports,Lifestyle,Shopping,Food - Drink,Literature,Night Life,Arts - Entertainment,Music,Meetings,Food - Drink,Experiences,Travel,Spiritual,Others
    
    	//Example of custom endpoint call with categories filter
    	https://wwevents.fun/?lat=38.720176&lng=-9.139717&categories=Meetings,Others
    			


  • Integration on Android with Webview
  • MainActivity.java
    
    package com.wwevents.events.events;
    
    import android.app.Activity;
    import android.support.v4.view.MenuItemCompat;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;
    import android.view.Window;
    import android.webkit.WebSettings;
    import android.webkit.WebView;
    import android.widget.AdapterView;
    import android.widget.ArrayAdapter;
    import android.widget.Spinner;
    import android.widget.Toast;
    
    public class MainActivity extends AppCompatActivity {
    
        private WebView mWebView;
        public static Activity activity;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            activity = this;
    
            mWebView = (WebView) findViewById(R.id.activity_home_webview);
            WebSettings webSettings = mWebView.getSettings();
            webSettings.setJavaScriptEnabled(true);
            mWebView.setWebViewClient(new WebViewClient());
            mWebView.setWebChromeClient(new WebChromeClient(){    });
            mWebView.loadUrl("https://wwevents.fun/");
        }
    
        @Override
        public void onBackPressed() {
            if(mWebView.canGoBack()) {
                mWebView.goBack();
            } else {
                super.onBackPressed();
            }
        }
    }
    			
    WebChromeClient.java
    
    package com.wwevents.events.events;
    
    import android.app.ProgressDialog;
    import android.webkit.WebView;
    
    public class WebChromeClient extends android.webkit.WebChromeClient {
    
    
        public void onProgressChanged(WebView view, int progress) {
    
            MainActivity.activity.setTitle("Loading...");
    
            if(progress == 100)
                MainActivity.activity.setTitle(R.string.app_name);
    
        }
    }
    			
    WebViewClient.java
    
    package com.wwevents.events.events;
    
    import android.content.ActivityNotFoundException;
    import android.content.Intent;
    import android.graphics.Bitmap;
    import android.net.Uri;
    import android.webkit.WebView;
    
    public class WebViewClient extends android.webkit.WebViewClient {
    
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if(Uri.parse(url).getHost().contains("wwevents.fun")){
                return false;
            }
    
            try{
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                view.getContext().startActivity(intent);
            } catch (ActivityNotFoundException e) {
                e.printStackTrace();
            }
            return true;
        }
    
        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
        }
    
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
        }
    }
    			
    activity_main.xml
    
    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.wwevents.events.events.MainActivity">
    
        <WebView
            android:id="@+id/activity_home_webview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </FrameLayout>
    			
    AndroidManifest.xml
    
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.wwevents.events.events">
    
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <activity android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>
    			


  • Integration on iPhone ios with Webview
  • Very similar to Android Demo above. Consult the Apple tutorial.




    Integration with API

  • Soon will be available our API