Skip to content

Commit e51e332

Browse files
committed
Fixed Android Return Types
Instead of a number, returned format from scanSuccess is now "Image" or "Barcode".
1 parent 4969909 commit e51e332

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# MS4Plugin
2+
####A third-party Phonegap plugin for iOS and Android that implements the Moodstocks v4 SDK.
23

3-
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.
4-
iOS compatability has been tested with OS X Yosemite, and Phonegap 4.3 and we see no problems.
4+
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.
55

66
Until I have a complete installation guide [watch this video for Android installation](https://www.youtube.com/watch?v=TgIBX6r1nl4).
7+
78
And [watch this video for iOS installation](https://www.youtube.com/watch?v=TgIBX6r1nl4).
89

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

3738
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`.
3839

39-
#### Compatibility
40-
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.
41-
42-
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.
43-
44-
The `scanSuccess` function now returns a JSON object with three properties, `format`, `value`, and `recognisedFrame`. Currently `recognisedFrame` is unimplemented.
40+
#### Compatibility with previous version of the Moodstocks phonegap plugin
41+
*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.
42+
* The `scanSuccess` function now returns a JSON object with three properties, `format`, `value`, and `recognisedFrame`. Currently `recognisedFrame` is unimplemented.
43+
* 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.
44+
* Bundle loading is supported on Android, and soon on iOS. A partial implementation is included in the demo app but not activated.
45+
* Camera roll recognition is supported by a completely new function and demonstrated in the demo app.
4546

46-
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.
47+
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.
4748

4849
##### Camera issues
4950
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.
@@ -59,7 +60,7 @@ The old pattern of attaching and detaching the cordovaWebview to the scanningVie
5960
A new callback system has been implemented which uses NSNotificationCenter to communicate between the ScannerViewController and the cordovaWebview within the MainViewController.
6061

6162
#### Unimplemented features
62-
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.
63+
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.
6364

6465
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.
6566

src/android/AutoScanFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void onResult(Result result) {
143143

144144
JSONObject obj = new JSONObject();
145145
try {
146-
obj.put("format", result.getType());
146+
obj.put("format", result.getType() == Result.Type.IMAGE ? "Image" : "Barcode");
147147
obj.put("value", result.getValue());
148148
//obj.put("recognisedFrame", encodedFrame);
149149
} catch (JSONException e) {

src/android/ManualScanFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public void onResult(Result result, Bitmap bitmap) {
157157
if (result != null) {
158158
JSONObject obj = new JSONObject();
159159
try {
160-
obj.put("format", result.getType());
160+
obj.put("format", result.getType() == Result.Type.IMAGE ? "Image" : "Barcode");
161161
obj.put("value", result.getValue());
162162
} catch (JSONException e) {
163163
e.printStackTrace();

0 commit comments

Comments
 (0)