Android 应用因 Fortumo 应用内支付而崩溃
应用程序代码是
package com.musicdownloader;
import com.fortumo.android.PaymentActivity;
import com.musicdownloader.R;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.view.View.OnClickListener;
public class app extends PaymentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
makePayment();
Button payButton = (Button) findViewById(R.id.Next);
payButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
final EditText q = (EditText) findViewById(R.id.q);
Intent i = new Intent("android.intent.action.VIEW", Uri.parse("http://www.google.com/search?btnI&q=zippyshare" +q.getText().toString()));
startActivity(i);
}
});
}
@Override
protected void onPaymentCanceled(String arg0) {
// TODO Auto-generated method stub
}
@Override
protected void onPaymentFailed(String arg0) {
// TODO Auto-generated method stub
}
@Override
protected void onPaymentPending(long arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
protected void onPaymentSuccess(String arg0) {
// TODO Auto-generated method stub
}
}
,xml文件是
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.musicdownloader"
android:versionCode="1"
android:versionName="1.0" android:installLocation="auto">
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".app">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:theme="@android:style/Theme.Translucent.NoTitleBar" android:name="com.fortumo.android.FortumoActivity" android:taskAffinity="com.fortumo.android.FortumoActivity"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.READ_OWNER_DATA" />
<uses-permission android:name="android.permission.WRITE_OWNER_DATA" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
</application>
</manifest>
我希望有人帮助我在应用程序支付中使用fortumo。为什么应用程序崩溃?
The app code is
package com.musicdownloader;
import com.fortumo.android.PaymentActivity;
import com.musicdownloader.R;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.view.View.OnClickListener;
public class app extends PaymentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
makePayment();
Button payButton = (Button) findViewById(R.id.Next);
payButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
final EditText q = (EditText) findViewById(R.id.q);
Intent i = new Intent("android.intent.action.VIEW", Uri.parse("http://www.google.com/search?btnI&q=zippyshare" +q.getText().toString()));
startActivity(i);
}
});
}
@Override
protected void onPaymentCanceled(String arg0) {
// TODO Auto-generated method stub
}
@Override
protected void onPaymentFailed(String arg0) {
// TODO Auto-generated method stub
}
@Override
protected void onPaymentPending(long arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
protected void onPaymentSuccess(String arg0) {
// TODO Auto-generated method stub
}
}
and the xml file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.musicdownloader"
android:versionCode="1"
android:versionName="1.0" android:installLocation="auto">
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".app">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:theme="@android:style/Theme.Translucent.NoTitleBar" android:name="com.fortumo.android.FortumoActivity" android:taskAffinity="com.fortumo.android.FortumoActivity"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.READ_OWNER_DATA" />
<uses-permission android:name="android.permission.WRITE_OWNER_DATA" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
</application>
</manifest>
I want somebody to help me with fortumo in app payment. Why does the app crash??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
建议在按钮的onclick中调用make payment。这会触发短信支付周期。
编辑
建议您在清单中添加 PaymentActivity 以及 fortumoactivity ,即,这两项活动都需要声明。
Suggest to call makepayment in onclick of button. this triggers the sms payment cycle.
EDIT
Suggest that you add PaymentActivity in your manifest along with fortumoactivity ie., both activities need to be declared.