Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
deeeed committed Oct 3, 2017
0 parents commit c4e9fa4
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 0 deletions.
Empty file added LICENSE
Empty file.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cordova Plugin Template
======

This is a simple starting point for building a Cordova plugin on iOS and Android.
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "cordova-plugin-androidapkinfo",
"version": "1.0.0",
"author": {
"name" : "Arthur Breton",
"email" : "[email protected]",
"url" : "http://siteed.net/"
},
"repository": {
"type": "git",
"url" : "https://github.com/deeeed/cordova-plugin-fixioskeyboard"
},
"cordova": {
"id": "cordova-plugin-template",
"platforms": [
"android"
]
},
"description": "Extract APK infos"
}
31 changes: 31 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-androidapkinfo"
version="1.0.0">
<name>Cordova Plugin To Extract infos from APK</name>
<description></description>
<license>MIT</license>
<author>Arthur Breton</author>
<keywords>IOS Keyboard Slow</keywords>
<repo>https://github.com/deeeed/cordova-plugin-fixioskeyboard</repo>
<issue>https://github.com/deeeed/cordova-plugin-fixioskeyboard/issues</issue>

<!-- android -->
<platform name="android">
<js-module src="www/plugin.js" name="plugin">
<runs/>

<!-- This is the window variable name you want, like window.MyCordovaPlugin -->
<clobbers target="AndroidAPKInfo" />
</js-module>
<config-file target="res/xml/config.xml" parent="/*">
<feature name="MyCordovaPlugin">
<param name="android-package" value="net.siteed.AndroidAPKInfoPlugin" />
<param name="onload" value="true" />
</feature>
</config-file>

<source-file src="src/android/com/example/MyCordovaPlugin.java" target-dir="src/com/example/" />
</platform>
</plugin>
41 changes: 41 additions & 0 deletions src/android/net/siteed/AndroidAPKInfoPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
*/
package com.example;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginResult;
import org.apache.cordova.PluginResult.Status;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;

import android.util.Log;

import java.util.Date;

public class MyCordovaPlugin extends CordovaPlugin {
private static final String TAG = "MyCordovaPlugin";

public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);

Log.d(TAG, "Initializing MyCordovaPlugin");
}

public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
if(action.equals("echo")) {
String phrase = args.getString(0);
// Echo back the first argument
Log.d(TAG, phrase);
} else if(action.equals("getDate")) {
// An example of returning data back to the web layer
final PluginResult result = new PluginResult(PluginResult.Status.OK, (new Date()).toString());
callbackContext.sendPluginResult(result);
}
return true;
}

}
15 changes: 15 additions & 0 deletions www/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

var exec = require('cordova/exec');

var PLUGIN_NAME = 'AndroidAPKInfo';

var AndroidAPKInfo = {
echo: function(phrase, cb) {
exec(cb, null, PLUGIN_NAME, 'echo', [phrase]);
},
getDate: function(cb) {
exec(cb, null, PLUGIN_NAME, 'getDate', []);
}
};

module.exports = AndroidAPKInfo;

0 comments on commit c4e9fa4

Please sign in to comment.