Skip to content

thiagoschnell/webappapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebApp Api for Android

WebApp Api is Android extended Webview Client are flexible, safe and easier request your Api and supports for using Cross-Origin Resource Sharing (CORS).

This sample WebApp app uses App Message integration for send and receive messages through broadcasts.

Through the integrated AppMessage allow request Api by activity A and Return the Response to activity B or A.

AppMessage integration are fully replaced with the new AppMessenger (AppMessenger.java , Messenger.java, MessengerConnectionManager.java , ShuffleCrypt.java, Example )

minimum SDK version: Android 5.0 (API 21) (recommended), but you also can run on Android 4.4 (API 19) and higher.

Download Android Studio and Configure

Now Webapp Api can run with your favorite android version with full compatible with latest versions:

License

This repository is available under the MIT License.

Developer sources

Android Integrations such as App Message, Webview has also provides demo with detailed usage.

Server Files for this WebApp app sample

Shop Site Demo for usage example purpouses

Documentation for CORS

User guide

  • user guide page This guide contains examples on how to use WebApp Api in your code

Examples

ULTIMATE WEBAPP EXAMPLEalt_text alt_textalt_text

The Ultimate WebApp Example uses the new AppMessenger.java and the service Messenger.java based of last example Messenger Service. With Appmessenger you can send request to messenger(Server service) and response back to other active client connection (AppMessenger) that you have created. Go to MessengerConnectionManager.java and move here then Create a new ConnectionPolicy for the Class that you want to allow connect, you can choose CONNECTION_NORMAL or CONNECTION_MULTCLIENT . Also, now all async requests information are crypted by ShuffleCrypt.java. Ultimate Webapp example files here , SuffleCrypt demo here, AppMessenger demo here

alt_text

Demo usage of one Real App Example

alt_text

Messenger Service Example

Messenger Service are written from zero and is a (IPC) same as WebApp service but the diferente is the WebApp Service run on inside activity only and Messenger Service run in application for all activities.
In this example we extended the application with Messenger Service to become usage with Livedata, when this listening changes they send request as messenger client and then execute it inside messenger server that are running the webapp and back it to handler click callback. Example usage, Messenger Service files

alt_text

WebApp Service Example

Example of WebApp Service ThreadLess and request without UI Thread Blocking example, service source files

alt_text

**Zip Website Example**

Create a app and deliver the mobile version of your website,
implement webappapi to make requests,
load from zip your website, create a new version for the website from update.zip by url to download and install it, instant patch the website files from a external link patch.zip
Website to your Android app made easy its just need a zip file! Zip Website files, Demo example here

alt_text

**Zip Website using CORS Example**

This is example of Zip Website using CORS Example shows how setup allowed CORS domains for incoming request links in the websitewithcors.zip files. Example here, Apache MultiViews documentation

alt_text

Api Notification Service
Note: in Android API 33 and higher you are required asking the user for grant permissions to post notifications.

alt_text

Internet Connection - Realtime Network Status

Check the internet status in realtime before requesting any url

alt_text

UPDATE - Job Scheduler CheckPurchaseStatus

By default BackoffPolicy.LINEAR run as 10,20,30 seconds and multiply it by x times will happen, ex: 10s * how many times the work has been retried (for BackoffPolicy.LINEAR), and for BackoffPolicy.Exponential will be even longe.
Now this example has updated to run dynamically 10,20,30 seconds.

alt_text

Download Checksum

alt_text

Stream Download Example

alt_text

Download PDF Example

alt_text

Download Image Example

alt_text

New Response Live Data

alt_text

JobScheduler Example

alt_text

LoadDataWithBaseUrl Request

alt_text

Single Request

alt_text

On Demand Requests

alt_text

On Demand "Parallel" Requests

alt_text

REQUEST WITH NO INTERNET

webapp-api-example1-connection_error

LOADING WITH NO INTERNET

webappapi-example1-load-error