android-js / androidjs-core-webview

Node js for android app development
26 stars 17 forks source link

adding changes to android js #29

Closed ghost closed 2 years ago

ghost commented 2 years ago

Description

this code include some new features oriented to Android Buttons and States, and Android Intents like:

-android.setOrientation( orientation )

 orientation = portrait or landscape

-android.onVolumeDownPressed() -android.onVolumeUpPressed() -android.onBackPressed()

-android.onVolumeDownReleased() -android.onVolumeUpReleased() -android.onBackReleased()

 these are functions, so if you want use them, make a code like this:
 android.onBackPressed = ()=>{
    //Place your code here
 }

or

 android.onBackPressed = function(){
    //Place your code here
 }

-android.AndroidIntent( URL )

the string should be an URL, and should be something like this:
intent:  
   HOST/URI-path // Optional host  
   #Intent;  
      package=\[string\];  
      action=\[string\];  
      category=\[string\];  
      component=\[string\];  
      scheme=\[string\];  
   end;

I recommend read this page:
https://developer.chrome.com/docs/multidevice/android/intents/

-android.IntentRaw( path, type, action, Url, extras ) -android.IntentOpenUrl( Url ) -android.IntentOpenFile( path, type )

type is the file mimetype like:
audio/mp3 or video/mp4 or text/html

-android.IntentOpenApp( AppName, Url )

 -AppName is the package name
 -Url is optional, in case the aplication is not installed
 -Url should be the google play store Url of the app

-IntentShare( Message )

Type of change

How Has This Been Tested?

The has been tested on Android 5.0 and the google chrome remote inspector.

Checklist:

ghost commented 2 years ago

Hi, my name is Enmanuel Becerra, and I like your project, actually this project is really usefull, and I'm using this repo for some personal projects. like these:

link: https://github.com/Bececrazy/wacomdroid link: https://github.com/Bececrazy/onlyplus

So I would like to make a contribution to this helpfull project, like adding Android-Intents, and also adding Android-Button-Events.

I hope you take my contribution.

Chhekur commented 2 years ago

Hey @Bececrazy, thanks for the PR, but we don't maintain the API data here in this repository. we maintain them here android-native-apis. can you raise a PR there for the changes?