Skip to content
Browse files

Get wikitude plugin working for phonegap 1.9.0

  • Loading branch information...
1 parent afa25d9 commit 8df0cc02a8fe69c26430a20884d7f8386f9998f4 @gmh04 gmh04 committed Jul 19, 2012
Showing with 14 additions and 13 deletions.
  1. +10 −9 Android/WikitudeCamera/WikitudeCamera.java
  2. +4 −4 Android/WikitudeCamera/wikitudecamera.js
View
19 Android/WikitudeCamera/WikitudeCamera.java
@@ -17,14 +17,14 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
-import com.phonegap.api.PhonegapActivity;
-import com.phonegap.api.Plugin;
-import com.phonegap.api.PluginResult;
+import org.apache.cordova.api.Plugin;
+import org.apache.cordova.api.PluginResult;
/**
* This calls out to the Wikitude SDK and returns the result.
@@ -34,7 +34,7 @@
public static final String ACTION = "show";
public static final int REQUEST_CODE = 0x0ba7c0de;
public String callback;
-
+
public static final String defaultInstallTitle = "Install Wikitude Browser?";
public static final String defaultInstallMessage = "This requires the free Wikitude Browser app. Would you like to install it now?";
public static final String defaultYesString = "Yes";
@@ -82,7 +82,7 @@ public PluginResult execute(String action, JSONArray args, String callbackId) {
// add POIs to AR intent
WikitudeARIntent intent = new WikitudeARIntent(
- this.ctx.getApplication(), null, null);
+ this.ctx.getActivity().getApplication(), null, null);
intent.addPOIs(pois);
intent.addTitleText(extract(options, "title"));
@@ -138,9 +138,10 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
}
}
}
-
+
private void showDownloadDialog(final String title, final String message, final String yesString, final String noString) {
- final PhonegapActivity context = this.ctx;
+ final Context context = this.ctx.getContext();
+ final Activity activity = this.ctx.getActivity();
Runnable runnable = new Runnable() {
public void run() {
@@ -154,7 +155,7 @@ public void onClick(DialogInterface dlg, int i) {
Uri.parse("market://search?q=pname:com.wikitude")
);
try {
- context.startActivity(intent);
+ activity.startActivity(intent);
} catch (ActivityNotFoundException e) {
// We don't have the market app installed.
e.printStackTrace();
@@ -171,7 +172,7 @@ public void onClick(DialogInterface dlg, int i) {
dialog.show();
}
};
- context.runOnUiThread(runnable);
+ activity.runOnUiThread(runnable);
}
}
View
8 Android/WikitudeCamera/wikitudecamera.js
@@ -2,18 +2,18 @@
* Phonegap Wikitude AR Camera plugin
* Copyright (c) Spletart 2011
*/
-var WikitudeCamera = function() {
+var WikitudeCamera = function() {
}
WikitudeCamera.prototype.show = function(data, success, fail, options) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'WikitudeCamera', 'show', [data, options]);
};
-PhoneGap.addConstructor(function() {
- PhoneGap.addPlugin('wikitudeCamera', new WikitudeCamera());
+cordova.addConstructor(function() {
+ cordova.addPlugin('wikitudeCamera', new WikitudeCamera());
});

0 comments on commit 8df0cc0

Please sign in to comment.
Something went wrong with that request. Please try again.