Skip to content

Commit

Permalink
Fixed Android Return Types
Browse files Browse the repository at this point in the history
Instead of a number, returned format from scanSuccess is now "Image" or
"Barcode".
  • Loading branch information
thomasforth committed May 19, 2015
1 parent 4969909 commit e51e332
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# MS4Plugin
####A third-party Phonegap plugin for iOS and Android that implements the Moodstocks v4 SDK.

A third-party Phonegap plugin that implements the Moodstocks v4 SDK for Android and iOS. It is developed by Thomas Forth at [imactivate](http://www.imactivate.com/) and tested for Android with Phonegap v3.1, on Windows and Mac, in Eclipse. Small changes in installation procedure may be required with newer version of Phonegap but we foresee no major compatibility issues. The phonegap camera plugin requires that the Android SDK version used for development is 4.4.x or newer.
iOS compatability has been tested with OS X Yosemite, and Phonegap 4.3 and we see no problems.
Developed by Thomas Forth at [imactivate](http://www.imactivate.com/). Tested for Android with Phonegap v3.1, on Windows and Mac, in Eclipse. iOS compatibility tested with OS X Yosemite, and Phonegap 4.3.

Until I have a complete installation guide [watch this video for Android installation](https://www.youtube.com/watch?v=TgIBX6r1nl4).

And [watch this video for iOS installation](https://www.youtube.com/watch?v=TgIBX6r1nl4).

#### Installation (Android)
Expand Down Expand Up @@ -36,14 +37,14 @@ Your project should now compile and install. Additionally you may want to instal

In `Staging/www/` delete `index.html` and replace it with the `index.html` from the [Moodstocks v4 Phonegap Demo](https://github.com/thomasforth/MS4Plugin/). Add the content of the Demo's `img` folder to `Staging/www/img`.

#### Compatibility
At the Phonegap level the API is largely unchanged from the [Moodstocks v3.7 phonegap plugin](https://github.com/Moodstocks/moodstocks-phonegap-plugin) and porting should be straightforward.

The `scanOptions` object now requires a `scanType` to be defined. This can be either `auto` or `manual`. Both use cases are included in the demo app. Bundle loading is supported but not required. A partial implementation is included in the demo app but not activated. Camera roll recognition is supported by a completely new function and demonstrated in the demo app.

The `scanSuccess` function now returns a JSON object with three properties, `format`, `value`, and `recognisedFrame`. Currently `recognisedFrame` is unimplemented.
#### Compatibility with previous version of the Moodstocks phonegap plugin
*At the Phonegap level the API is largely unchanged from the [Moodstocks v3.7 phonegap plugin](https://github.com/Moodstocks/moodstocks-phonegap-plugin) and porting should be straightforward.
* The `scanSuccess` function now returns a JSON object with three properties, `format`, `value`, and `recognisedFrame`. Currently `recognisedFrame` is unimplemented.
* The `scanOptions` object now requires a `scanType` to be defined. This can be either `auto` or `manual`. Both use cases are included in the demo app.
* Bundle loading is supported on Android, and soon on iOS. A partial implementation is included in the demo app but not activated.
* Camera roll recognition is supported by a completely new function and demonstrated in the demo app.

This release drops support for Android 2.x. Users who require this should use the [Moodstocks v3.7 phonegap plugin](https://github.com/Moodstocks/moodstocks-phonegap-plugin). Developed with Phonegap 3.1, in Eclipse, on Windows 8.1. Android Studio is not supported; Phonegap is the barrier to this.
This release drops support for Android 2.x. Users who require this should use the [Moodstocks v3.7 phonegap plugin](https://github.com/Moodstocks/moodstocks-phonegap-plugin). Android Studio is not supported; Phonegap is the barrier to this.

##### Camera issues
On 2015/04/15 the package id of the default cordova camera plugin changed from org.apache.cordova.camera to cordova-plugin-camera. We have updated our plugin and this should cause no problem but is worth noting.
Expand All @@ -59,7 +60,7 @@ The old pattern of attaching and detaching the cordovaWebview to the scanningVie
A new callback system has been implemented which uses NSNotificationCenter to communicate between the ScannerViewController and the cordovaWebview within the MainViewController.

#### Unimplemented features
We have not yet implemented Bundles for iOS. This is coming soon and we foresee no difficulties. If you need this *now*, please get in touch.
We have not yet implemented fully-offline bundles for iOS. This is coming soon and we foresee no difficulties. If you need this *now*, please get in touch.

We do not return the frames that were recognised. We have this feature running on both iOS and Android for both Manual and Auto scanner sessions but difficulties implementing the feature on iOS mean we are not making this publicly available. Specifically, returning query frames in iOS greatly slowed recognition resulting in unacceptable performance. Significant architecture changes will be required to allow the user to specify whether they want the queryFrames returned or not so this slowdown could not be avoided in the majority of cases where the user does not want the queryFrame returned. If you need this feature, please get in touch and I will be happy to work with you to make it happen.

Expand Down
2 changes: 1 addition & 1 deletion src/android/AutoScanFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void onResult(Result result) {

JSONObject obj = new JSONObject();
try {
obj.put("format", result.getType());
obj.put("format", result.getType() == Result.Type.IMAGE ? "Image" : "Barcode");
obj.put("value", result.getValue());
//obj.put("recognisedFrame", encodedFrame);
} catch (JSONException e) {
Expand Down
2 changes: 1 addition & 1 deletion src/android/ManualScanFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void onResult(Result result, Bitmap bitmap) {
if (result != null) {
JSONObject obj = new JSONObject();
try {
obj.put("format", result.getType());
obj.put("format", result.getType() == Result.Type.IMAGE ? "Image" : "Barcode");
obj.put("value", result.getValue());
} catch (JSONException e) {
e.printStackTrace();
Expand Down

0 comments on commit e51e332

Please sign in to comment.