导航
1 /** 2 * PhoneGap is available under *either* the terms of the modified BSD license *or* the 3 * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. 4 * 5 * Copyright (c) Matt Kane 2010 6 * Copyright (c) 2011, IBM Corporation 7 */ 8 9 package com.phonegap.plugins.baidumap; 10 11 import java.io.File; 12 import java.net.URISyntaxException; 13 14 import org.apache.cordova.CallbackContext; 15 import org.apache.cordova.CordovaPlugin; 16 import org.json.JSONArray; 17 import org.json.JSONException; 18 import org.json.JSONObject; 19 20 import android.app.Activity; 21 import android.content.Intent; 22 import android.net.Uri; 23 import android.util.Log; 24 25 /** 26 * This calls out to the ZXing barcode reader and returns the result. 27 */ 28 public class BaiduNav extends CordovaPlugin { 29 private static final String pgbaidumapljdh = "pgbaidumapljdh";//�������ݳ������е���·������ 30 private static final String pgbaidumapsearch = "pgbaidumapsearch"; //�ܱ߲�ѯ 31 32 private static final String showNav = "showNav";//��ַ��ѯ 33 private static final String CITY = "city"; 34 private static final String ADDRESS = "address"; 35 36 37 private static final String LOCA = "location"; 38 39 private static final String FROM = "from"; 40 private static final String TO = "to"; 41 private static final String REG = "region"; 42 43 private static final String QUERY = "query"; 44 private static final String CITYLOC = "cityloc"; 45 46 47 public String callback; 48 49 /** * Constructor.*/ 50 51 52 public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { 53 54 if (action.equals(showNav)) { 55 56 JSONObject cityad = args.optJSONObject(0); 57 Intent Intent = new Intent(); 58 59 //Intent.putExtra("city", city); //��ֵ��BaiduMapActivity 60 //Intent.putExtra("address", address);//��ֵ��BaiduMapActivity 61 Intent.setClass(cordova.getActivity(), RouteGuideDemo.class);//������һ��activity 62 Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 63 this.cordova.getActivity().startActivity(Intent); 64 /*if (cityad != null) 65 { 66 //String city = cityad.optString(CITY); 67 //String address = cityad.optString(ADDRESS); 68 //Log.d("����", "���У�" + city); 69 //Log.d("��ַ", "��ַ��" + address); 70 71 Intent Intent = new Intent(); 72 73 //Intent.putExtra("city", city); //��ֵ��BaiduMapActivity 74 //Intent.putExtra("address", address);//��ֵ��BaiduMapActivity 75 Intent.setClass(cordova.getActivity(), DemoMainActivity.class);//������һ��activity 76 Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 77 this.cordova.getActivity().startActivity(Intent); 78 79 } else { 80 callbackContext.error("错误"); 81 return false; 82 }*/ 83 84 } 85 else if (action.equals(pgbaidumapljdh)) { 86 //JSONObject adljdh = args.optJSONObject(0); //��ʱ���� 87 88 }else { 89 callbackContext.error("Invalid Action"); 90 return false; 91 } 92 93 return true; 94 } 95 } 96 97
/**
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
*
* Copyright (c) Matt Kane 2010
* Copyright (c) 2011, IBM Corporation
*/
package com.phonegap.plugins.baidumap;
import java.io.File;
import java.net.URISyntaxException;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
/**
* This calls out to the ZXing barcode reader and returns the result.
*/
public class BaiduNav extends CordovaPlugin {
private static final String pgbaidumapljdh = "pgbaidumapljdh";//�������ݳ������е���·������
private static final String pgbaidumapsearch = "pgbaidumapsearch"; //�ܱ߲�ѯ
private static final String showNav = "showNav";//��ַ��ѯ
private static final String CITY = "city";
private static final String ADDRESS = "address";
private static final String LOCA = "location";
private static final String FROM = "from";
private static final String TO = "to";
private static final String REG = "region";
private static final String QUERY = "query";
private static final String CITYLOC = "cityloc";
public String callback;
/** * Constructor.*/
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
if (action.equals(showNav)) {
JSONObject cityad = args.optJSONObject(0);
Intent Intent = new Intent();
//Intent.putExtra("city", city); //��ֵ��BaiduMapActivity
//Intent.putExtra("address", address);//��ֵ��BaiduMapActivity
Intent.setClass(cordova.getActivity(), RouteGuideDemo.class);//������һ��activity
Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.cordova.getActivity().startActivity(Intent);
/*if (cityad != null)
{
//String city = cityad.optString(CITY);
//String address = cityad.optString(ADDRESS);
//Log.d("����", "����" + city);
//Log.d("��ַ", "��ַ��" + address);
Intent Intent = new Intent();
//Intent.putExtra("city", city); //��ֵ��BaiduMapActivity
//Intent.putExtra("address", address);//��ֵ��BaiduMapActivity
Intent.setClass(cordova.getActivity(), DemoMainActivity.class);//������һ��activity
Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.cordova.getActivity().startActivity(Intent);
} else {
callbackContext.error("错误");
return false;
}*/
}
else if (action.equals(pgbaidumapljdh)) {
//JSONObject adljdh = args.optJSONObject(0); //��ʱ����
}else {
callbackContext.error("Invalid Action");
return false;
}
return true;
}
}
浙公网安备 33010602011771号