我想将 Zooz 的支付应用程序与我的 Android 应用程序集成,但是 Zooz 不会出现。没有给出或说明任何错误,但是当我在模拟器或手机上运行该应用程序时,它不会出现。该应用程序就像代码不存在一样运行。我知道我的问题很广泛,但是日志 cat 中没有给出关于 Zooz 的错误,也没有红色 x,我无法确定具体问题。该应用程序不会崩溃,它只是正常运行。有人可以帮我找出造成这种情况的原因吗,或者为什么 Zooz 不会出现?我正在尝试使用 Zooz,以便可以购买我菜单中的项目。
这是我用来集成代码的参考。总的来说,我对 Java 很陌生。我放置了 SDK 库并按照步骤操作,但没有任何反应。
https://app.zooz.com/portal/PortalController?cmd=resources
我尝试过的事情:
我尝试取出库并删除对 Zooz 的所有引用,然后从一开始就将其放回原处。我尝试过手写代码,而不是从 PDF 一步一步地复制粘贴。我检查了日志猫是否有任何对 Zooz 的引用,但该应用程序在我的模拟器和设备上都运行。我检查了我的引用库,例如,当我单击 a.class 时,它显示:JAR 文件 zooz_iap_1.4.4.6.jar 没有源附件。但这并不是一个错误。我应该尝试附加来源吗?(我还没有。)再说一次,我是 Android 的新手,我不确定这到底意味着什么,我不想无限期地毁了事情。我尝试使用发票步骤而不是发票集成步骤来运行代码。我不确定它是否是可选的,因为它没有指定。我也试过打电话给 Zooz 客户服务,但没有人接听办公室电话或手机。有人可以帮我找出问题吗?
这是我目前使用的代码,以防万一需要参考。
package com.carouseldemo.main;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View.OnClickListener;
import android.view.MenuInflater;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.FrameLayout;
import com.carouseldemo.controls.Carousel;
import com.carouseldemo.controls.CarouselAdapter;
import com.carouseldemo.controls.CarouselAdapter.AdapterContextMenuInfo;
import com.carouseldemo.controls.CarouselAdapter.OnItemClickListener;
import com.carouseldemo.controls.CarouselAdapter.OnItemSelectedListener;
import com.carouseldemo.controls.CarouselItem;
import com.powersourceinternational.main.R;
import com.zooz.android.lib.CheckoutActivity;
public class MainActivity extends Activity {
private static final String TAG = null;
private static final int ZooZ_Activity_ID = 0;
@Override
public boolean onContextItemSelected(MenuItem item) {
int id = item.getItemId(); // you know which menu is clicked
int imageId = -1;
switch (id) {
case 1:
imageId = R.drawable.productone;
break;
case 2:
imageId = R.drawable.product2;
break;
case 3:
imageId = R.drawable.product1;
break;
case 4:
imageId = R.drawable.product3;
break;
case 5:
imageId = R.drawable.product4;
break;
case 6:
imageId = R.drawable.product5;
break;
case 7:
imageId = R.drawable.product6;
break;
case 8:
imageId = R.drawable.product7;
break;
case 9:
imageId = R.drawable.product8;
break;
case 90:
imageId = R.drawable.product9andhalf;
break;
case 91:
imageId = R.drawable.product10;
break;
case 10:
imageId = R.drawable.chevy1;
break;
case 11:
imageId = R.drawable.nissanleaf;
break;
case 12:
imageId = R.drawable.honda;
break;
case 13:
imageId = R.drawable.prius;
break;
case 14:
imageId = R.drawable.tesla;
break;
case 15:
imageId = R.drawable.porsche;
break;
case 16:
imageId = R.drawable.fordfocus;
break;
case 166:
imageId = R.drawable.bmw;
break;
case 167:
imageId = R.drawable.fordc;
break;
case 168:
imageId = R.drawable.fisker;
break;
// ...the same for the other ids
}
ImageView popup = new ImageView(this);
popup.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
((FrameLayout) findViewById(android.R.id.content))
.removeView(v);
}
});
// set the image
popup.setImageResource(imageId);
((FrameLayout) findViewById(android.R.id.content)).addView(popup);
return super.onContextItemSelected(item);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.testmenu2, menu);
// your code...
return true;
}
public void onCheckoutClick(View v) {
// create new intent CheckoutActivity
Intent intent = new Intent(this, CheckoutActivity.class);
// supply app-key on the intent
intent.putExtra(CheckoutActivity.
ZOOZ_APP_KEY, "b8d0ff11-c60b-400d-82a0-0ed694e238b0");
// supply transaction details (amount, currency)
intent.putExtra(CheckoutActivity.
ZOOZ_AMOUNT, 33.5);
intent.putExtra(CheckoutActivity.
ZOOZ_CURRENCY_CODE, "USD");
// supply environment mode (sandbox or production)
intent.putExtra(CheckoutActivity.
ZOOZ_IS_SANDBOX, true);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent
data) {
if (requestCode == ZooZ_Activity_ID) {
switch (resultCode) {
case Activity.RESULT_OK:
Log.i(TAG, "Succefuly paid. Your transaction id is: " +
data.getStringExtra(CheckoutActivity.
ZOOZ_TRANSACTION_ID));
break;
case Activity.RESULT_CANCELED:
if (data != null)
Log.e(TAG, "Error, cannot complete payment with ZooZ." + "Error code: " +
data.getIntExtra(CheckoutActivity.ZOOZ_ERROR_CODE
, 0) + "; Error Message: " +
data.getStringExtra(CheckoutActivity.ZOOZ_ERROR_MSG));
break;
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
WebView webView;
// int id = item.getItemId();
// int imageId = -1;
switch (item.getItemId()) {
case R.id.item1:
Intent browserIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.powersourceinternational.com/"));
startActivity(browserIntent);
return true;
case R.id.item2:
webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://www.facebook.com/PowerSourceInternational");
// imageId = R.drawable.hippo;
// WebView wv2 = (WebView) findViewById(R.id.webview);
// wv2.loadUrl("file:///android_asset/resume_page2.html");
return true;
case R.id.item3:
webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://twitter.com/EnergyPSI");
return true;
case R.id.item4:
webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://pinterest.com/energypsi/");
return true;
}
return false;
}
// true if you want the menu to be displayed; false otherwise
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
// Just prepare ourself for unexpected arguments...
if (menuInfo == null) {
return;
}
if (!(menuInfo instanceof AdapterContextMenuInfo)) {
return;
}
AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfo;
// to identify the view according to this case values you could assing
// ids like this:
// case 0:
// menu.add(Menu.NONE, 1, Menu.NONE, "menu title");
// menu.add(Menu.NONE, 2, Menu.NONE, "menu title");
// menu.add(Menu.NONE, 3, Menu.NONE, "menu title");
// menu.add(Menu.NONE, 4, Menu.NONE, "menu title");
// etc
// case 1:
// menu.add(Menu.NONE, 1001, Menu.NONE, "menu title");
// menu.add(Menu.NONE, 1002, Menu.NONE, "menu title");
// menu.add(Menu.NONE, 1003, Menu.NONE, "menu title");
// menu.add(Menu.NONE, 1004, Menu.NONE, "menu title");
// etc
// case 2:
// menu.add(Menu.NONE, 2001, Menu.NONE, "menu title");
// menu.add(Menu.NONE, 2002, Menu.NONE, "menu title");
// etc
// this way the ids will be unique and in the onContextItemSelected
// method you'll be able to
// identify the current case(0, 1, 2, 3, 4, 5) and the id clicked
switch (mi.position) {
case 0:
menu.add(Menu.NONE, 0, Menu.NONE, "Products");
menu.add(Menu.NONE, 1, Menu.NONE, "EV2430WS Wall $1200.00");
menu.add(Menu.NONE, 2, Menu.NONE, "EV230WSR 3R Wall $1800.00");
menu.add(Menu.NONE, 3, Menu.NONE, "EV Parking Sign $65.00");
menu.add(Menu.NONE, 4, Menu.NONE, "Pedestal 1 Outdoor $3000.00");
menu.add(Menu.NONE, 5, Menu.NONE, "Pedestal 2 Outdoor $4600.00");
menu.add(Menu.NONE, 6, Menu.NONE, "CT500 Wall Mount $2665.00");
menu.add(Menu.NONE, 7, Menu.NONE, "CT2020 Family $6500.00");
menu.add(Menu.NONE, 8, Menu.NONE,
"DC Fast Charge CHAdeMO $35000.00");
menu.add(Menu.NONE, 9, Menu.NONE,
"The Power Share: Call for pricing");
menu.add(Menu.NONE, 90, Menu.NONE, "Solar Canopy one-car $13500.00");
menu.add(Menu.NONE, 91, Menu.NONE, "Solar Canopy Two car $18500.00");
break;
case 1:
menu.add(Menu.NONE, 900, Menu.NONE, "Top Ten Fuel Efficient Cars");
menu.add(Menu.NONE, 10, Menu.NONE, "Chevrolet Volt");
menu.add(Menu.NONE, 11, Menu.NONE, "Nissan Leaf");
menu.add(Menu.NONE, 12, Menu.NONE, "Honda");
menu.add(Menu.NONE, 13, Menu.NONE, "Toyota Prius");
menu.add(Menu.NONE, 14, Menu.NONE, "Tesla");
menu.add(Menu.NONE, 15, Menu.NONE, "Porsche");
menu.add(Menu.NONE, 16, Menu.NONE, "Ford Focus");
menu.add(Menu.NONE, 166, Menu.NONE, "BMW");
menu.add(Menu.NONE, 167, Menu.NONE, "Ford C");
menu.add(Menu.NONE, 168, Menu.NONE, "Fisker");
break;
case 2:
menu.add(Menu.NONE, 17, Menu.NONE, "About Us");
menu.add(Menu.NONE, 18, Menu.NONE, "Our solution includes the following:");
menu.add(Menu.NONE, 19, Menu.NONE, "Comprehensive Energy Assessment");
menu.add(Menu.NONE, 20, Menu.NONE, "Energy Sustainability Strategy");
menu.add(Menu.NONE, 21, Menu.NONE, "Energy Solutions Design");
menu.add(Menu.NONE, 22, Menu.NONE, "Solutions Implementation");
menu.add(Menu.NONE, 23, Menu.NONE, "Savings Verification Process");
menu.add(Menu.NONE, 24, Menu.NONE, "Engery Solutions Development");
break;
case 3:
menu.add(Menu.NONE, 25, Menu.NONE, "Consulting");
menu.add(Menu.NONE, 26, Menu.NONE, "Residential Site Survey: $250");
menu.add(Menu.NONE, 27, Menu.NONE, "Residential Energy Consulting: $250");
menu.add(Menu.NONE, 28, Menu.NONE, "Commercial Consulting: $1000");
menu.add(Menu.NONE, 29, Menu.NONE, "Energy Efficiency Site Audit: $500");
menu.add(Menu.NONE, 30, Menu.NONE, "Electric Vehicle Consulting: $250");
menu.add(Menu.NONE, 31, Menu.NONE, "Commercial Vehicle Consulting $500");
menu.add(Menu.NONE, 32, Menu.NONE, "Industrial Battery Bank: $500");
menu.add(Menu.NONE, 321, Menu.NONE, "EVSE Inspection $75.00/hr. $150 Fee");
break;
case 4:
menu.add(Menu.NONE, 33, Menu.NONE, "Leasing");
menu.add(Menu.NONE, 34, Menu.NONE, "Single Wall Mounted Unit");
menu.add(Menu.NONE, 35, Menu.NONE, "Unit ID: EV230WSR");
menu.add(Menu.NONE, 36, Menu.NONE, "2 Year Plan: $148.00");
menu.add(Menu.NONE, 37, Menu.NONE, "3 Year Plan: $103.00");
menu.add(Menu.NONE, 38, Menu.NONE, "5 Year Plan: $78.00");
menu.add(Menu.NONE, 39, Menu.NONE, "Single Bollard Mounted Unit");
menu.add(Menu.NONE, 40, Menu.NONE, "Unit ID: EV230PSR");
menu.add(Menu.NONE, 401, Menu.NONE, "2 Year Plan: $242.00");
menu.add(Menu.NONE, 403, Menu.NONE, "3 Year Plan: $168.00");
menu.add(Menu.NONE, 404, Menu.NONE, "5 Year Plan: $115.00");
menu.add(Menu.NONE, 405, Menu.NONE, "Double Bollard Mounted Unit");
menu.add(Menu.NONE, 406, Menu.NONE, "Unit ID: EV230PDR");
menu.add(Menu.NONE, 407, Menu.NONE, "2 Year Plan: $315.00");
menu.add(Menu.NONE, 408, Menu.NONE, "3 Year Plan: $243.00");
menu.add(Menu.NONE, 409, Menu.NONE, "5 Year Plan: $166.00");
break;
case 5:
menu.add(Menu.NONE, 41, Menu.NONE, "Contact Us");
menu.add(Menu.NONE, 42, Menu.NONE, "Phone: 678-951-0715");
menu.add(Menu.NONE, 43, Menu.NONE,
"Address: 6065 Roswell Road, Suite 500, Atlanta, Georgia 30328 ");
menu.add(Menu.NONE, 44, Menu.NONE,
"Website: Powersourceinternational.com");
menu.add(Menu.NONE, 45, Menu.NONE,
"Email: powersourcevids@gmail.com ");
menu.add(Menu.NONE, 46, Menu.NONE, "Fax: 678-951-8993");
menu.add(Menu.NONE, 47, Menu.NONE,
"Facebook: https://www.facebook.com/PowerSourceInternational");
menu.add(Menu.NONE, 48, Menu.NONE,
"Linkedin: http://www.linkedin.com/company/power-source-international");
break;
default:
break;
}
super.onCreateContextMenu(menu, v, menuInfo);
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Carousel carousel = (Carousel) findViewById(R.id.carousel);
carousel.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(CarouselAdapter<?> parent, View view,
int position, long id) {
CarouselItem item = (CarouselItem) parent.getChildAt(position);
// HERE: Force context menu
carousel.showContextMenuForChild(item);
Toast.makeText(
MainActivity.this,
String.format("%s has been clicked",
((CarouselItem) parent.getChildAt(position))
.getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.testmenu2, menu);
// TODO Auto-generated method stub
return true;
}
@Override
public boolean onContextItemSelected(MenuItem item) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
return false;
}
});
carousel.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(CarouselAdapter<?> parent, View view,
int position, long id) {
final TextView txt = (TextView) (findViewById(R.id.selected_item));
switch (position) {
case 0:
txt.setText("The PSI Process was developed as a result of consulting methodologies and infrastructure training with companies like General Electric, MCI and IBM. The executives at PSI have over 80 years of combined experience in working with fortune 50 companies to deliver on time solutions that reduce cost. Our staff now has the ability to utilize more than two dozen proven approaches and technologies to provide long-term savings of up to 30% or more with fast project paybacks. That’s a promise we back up with an insurance policy underwritten by one of the world’s oldest A+ rated insurance companies to remove all financial risk from your decision to invest with our company.");
break;
case 1:
txt.setText("In an age when Energy-based Buzz-words abound, PSI works to make it simple as well as profitable for you our customer. All throughout our customer's environments, PSI efforts have produced positive results often beyond expectations. Whether you're looking at Materials environment, Public Installations, the Lodging Industry or Office Complex installations, PSI can effect cost saving benefits that will truly enhance your bottom line! Because each business is different and unique, let us come and show you how we can make our solutions work for you!");
break;
case 2:
txt.setText("Power Source International (PSI) is setting the pace for engineering and environmental companies for you, our customer. PSI evaluates each and every facet of your site, focused on providing energy sustainability solutions. By looking at all of the different areas, we are not trying for a “Home Run” but several smaller hits that provides you with an integrated winning vehicle to increase your bottom line & your long-term competitive edge.");
break;
case 3:
txt.setText("PSI’s Executive Team has a broad based set of skills and experiences around consulting and implementation for industries in numerous sectors, including manufacturing, processing, transportation, healthcare, food and beverage, hospitality, retail and government agencies. The Company has also teamed with leading companies in the solar, wind and energy management arena. The team is further supported by an internal Board of Advisors formed by professionals from research, universities and the private sector.");
break;
case 4:
txt.setText("Want to install an EV charging solution but don’t want to pay for it all at once? No problem! We have leasing options to fit almost every budget.");
break;
case 5:
txt.setText("If you would like more information from PSI, please fill in the form. For immediate assistance, please contact us at 678-951-0715.");
break;
}
}
public void onNothingSelected(CarouselAdapter<?> parent) {
}
});
registerForContextMenu(carousel);
}
}