Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# dependencies
/node_modules
.DS_Store
test.html
test.html
./dist
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Android JS 2.0
[Android JS](https://android-js.github.io) framework lets you write android applications
using JavaScript, HTML and CSS or React Native with [Node.js](https://nodejs.org/) support. It is based on [Node.js](https://nodejs.org/).
using JavaScript, HTML and CSS or `React Native` with [Node.js](https://nodejs.org/) support. It is based on [Node.js](https://nodejs.org/).
It allows you to write fully featured android application in `node js` and provide you environment to use any `npm` package in your android app (i.e. SocketIO, fs, etc..)

## Installation
Expand Down
2 changes: 1 addition & 1 deletion build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Android JS 2.0
[Android JS](https://android-js.github.io) framework lets you write android applications
using JavaScript, HTML and CSS or React Native with [Node.js](https://nodejs.org/) support. It is based on [Node.js](https://nodejs.org/).
using JavaScript, HTML and CSS or `React Native` with [Node.js](https://nodejs.org/) support. It is based on [Node.js](https://nodejs.org/).
It allows you to write fully featured android application in `node js` and provide you environment to use any `npm` package in your android app (i.e. SocketIO, fs, etc..)

## Installation
Expand Down
2 changes: 1 addition & 1 deletion build/lib/androidjs.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions build/lib/react_native/androidjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ var toast = require("./api/toast");
var wifi = require("./api/wifi");
var call = require("./api/call");
var contact = require("./api/contact");
var deeplink = require("./api/deeplink");
module.exports = {
notification: notification,
hotspot: hotspot,
toast: toast,
wifi: wifi,
call: call,
contact: contact,
deeplink: deeplink,
getPath: app.getPath,
loadUrl: app.loadURL,
reload: app.reload
Expand Down
11 changes: 11 additions & 0 deletions build/lib/react_native/api/deeplink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use strict";
var NativeModules = require('react-native').NativeModules;
var deeplink = /** @class */ (function () {
function deeplink() {
}
deeplink.prototype.getLink = function () {
return NativeModules.DeepLink.getDeepLink();
};
return deeplink;
}());
module.exports = new deeplink();
48 changes: 48 additions & 0 deletions docs/deeplink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# DeepLink API
`app.deeplink` is the instance of `DeepLink API`, which provide functions to enable `DeepLink` to your app content.

`NOTE : In order to enable Deep Link to your app, you have to do all the following configurations.`

## `First Update Your Package.JSON`
In order to enable `Deep Link` to your app, you'll have to define array of objects with following attributes in `package.json` file of your app
- You need to define `deep-link` attribute in `package.json` which is array of `objects` of `scheme` and `host`
- You can define as many `scheme` and `host` you want

- `scheme`
- it is protocol on which you want to enable deep link your app
- `host`
- it is particular host on which you want to deep link your app

## Example Configuration
```json
{
"deep-link":[
{
"scheme" : "http",
"host" : "android-js.github.io"
},
{
"scheme" : "https",
"host" : "android-js.github.io"
}
]
}
```
whenever user click on `defined links or hosts`, your app will be `listed as suggestion` to `open` that `link in your app`
# Access Link In Your App
## Methods

#### `app.deeplink.getLink()`
Returns a `link` on which `user clicked` to `open` that in `your app`

`NOTE: returns link if available otherwise -1`
An example of above code:
```js
// In views of your app

let link = app.deeplink.getLink();
if(link != '-1') {
app.loadURL(link);
}
```

1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
- [Toast API](toast_api.md)
- [Call API](call_api.md)
- [Contact API](contact_api.md)
- [DeepLink API](deeplink_api.md)
- [App](app.md)
2 changes: 2 additions & 0 deletions src/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ files = [
['./src/react_native/androidjs/api/toast.ts', './dist/react_native/api'],
['./src/react_native/androidjs/api/wifi.ts', './dist/react_native/api'],
['./src/react_native/androidjs/api/contact.ts', './dist/react_native/api'],
['./src/react_native/androidjs/api/deeplink.ts', './dist/react_native/api'],
['./src/react_native/androidjs/androidjs.ts', './dist/react_native'],
['./src/react_native/androidjs/api/notification.ts', './build/lib/react_native/api'],
['./src/react_native/androidjs/api/app.ts', './build/lib/react_native/api'],
Expand All @@ -23,6 +24,7 @@ files = [
['./src/react_native/androidjs/api/toast.ts', './build/lib/react_native/api'],
['./src/react_native/androidjs/api/wifi.ts', './build/lib/react_native/api'],
['./src/react_native/androidjs/api/contact.ts', './build/lib/react_native/api'],
['./src/react_native/androidjs/api/deeplink.ts', './build/lib/react_native/api'],
['./src/react_native/androidjs/androidjs.ts', './build/lib/react_native']
]

Expand Down
2 changes: 2 additions & 0 deletions src/react_native/androidjs/androidjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import toast = require('./api/toast');
import wifi = require('./api/wifi');
import call = require('./api/call');
import contact = require('./api/contact');
import deeplink = require('./api/deeplink');

export = {
notification,
Expand All @@ -13,6 +14,7 @@ export = {
wifi,
call,
contact,
deeplink,
getPath: app.getPath,
loadUrl: app.loadURL,
reload: app.reload
Expand Down
9 changes: 9 additions & 0 deletions src/react_native/androidjs/api/deeplink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const NativeModules = require('react-native').NativeModules;

class deeplink {
public getLink(){
return NativeModules.DeepLink.getDeepLink();
}
}

export = new deeplink();
2 changes: 2 additions & 0 deletions src/webview/androidjs/androidjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import toast = require('./api/toast');
import wifi = require('./api/wifi');
import app = require('./api/app');
import contact = require('./api/contact');
import deeplink = require('./api/deeplink');

export = {
camera,
Expand All @@ -17,6 +18,7 @@ export = {
toast,
wifi,
contact,
deeplink,
getPath: app.getPath,
reload: app.reload,
loadURL: app.loadURL
Expand Down
8 changes: 4 additions & 4 deletions src/webview/androidjs/api/contact.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
class contact{
getAll(){
public getAll(){
return JSON.parse((<any>window).android.getAllContacts());
}

getCount(){
public getCount(){
return (<any>window).android.getContactsCount();
}

getByName(name){
public getByName(name:String){
return JSON.parse((<any>window).android.getContactByName(name));
}
add(name, number, email){
public add(name:String, number:String, email:String){
if(name == undefined) name = null;
if(number == undefined) number = null;
if(email == undefined) email = null;
Expand Down
7 changes: 7 additions & 0 deletions src/webview/androidjs/api/deeplink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class deeplink {
public getLink(){
return (<any>window).android.getDeepLink();
}
}

export = new deeplink();