本文整理汇总了Java中com.tencent.mm.opensdk.openapi.WXAPIFactory.createWXAPI方法的典型用法代码示例。如果您正苦于以下问题:Java WXAPIFactory.createWXAPI方法的具体用法?Java WXAPIFactory.createWXAPI怎么用?Java WXAPIFactory.createWXAPI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.mm.opensdk.openapi.WXAPIFactory
的用法示例。
在下文中一共展示了WXAPIFactory.createWXAPI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PayWXStart
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
public PayWXStart(Context mContext, int mOrderId){
context = mContext;
orderId = mOrderId;
aCache = ACache.get(GApplication.getInstance());
loginData = (LoginData) aCache.getAsObject(ACacheKey.CURRENT_ACCOUNT);
api = WXAPIFactory.createWXAPI(context, Constants.APP_ID);
api.registerApp(Constants.APP_ID);
Log.e("aaa", "orderId:" + orderId);
Log.e("aaa", loginData.getToken());
api.registerApp(Constants.APP_ID);
getPayData();
}
示例2: shareToWX
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
/**
* @param flag
* 0 发送到会话
* 1 发送到朋友圈
*/
private int shareToWX(int flag){
String text = mDetailItem.getUserName()+"说: "+mDetailItem.getRantContent()+" " + "\n目前有"+mDetailItem.getCommentList().size()+"人围观,来凑个热闹吧!";
final IWXAPI iwxapi = WXAPIFactory.createWXAPI(this, getString(R.string.app_id));
iwxapi.registerApp(getString(R.string.app_id));
if(!iwxapi.isWXAppInstalled()){
Toast.makeText(this, "你还没有安装微信", Toast.LENGTH_SHORT).show();
return 0;
}
WXWebpageObject webpage = new WXWebpageObject();
webpage.webpageUrl = getString(R.string.ip_server)+"rant.action?rantId="+mDetailItem.getRantId();
final WXMediaMessage msg = new WXMediaMessage(webpage);
msg.title = "Rant社区";
msg.description = text;
final SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = String.valueOf(System.currentTimeMillis());
req.scene = flag;
final Bitmap logo = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
msg.setThumbImage(logo);
req.message = msg;
iwxapi.sendReq(req);
return 1;
}
示例3: onCreate
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_wxentry);
// 通过WXAPIFactory工厂,获取IWXAPI的实例
api = WXAPIFactory.createWXAPI(this, APP_ID, false);
api.handleIntent(getIntent(), this);
}
示例4: onCreate
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
api = WXAPIFactory.createWXAPI(this, AppConfig.getWeixinAppId(), false);
try {
api.handleIntent(getIntent(), this);
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: initData
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
protected void initData() {
instance = this;
context = this;
api = WXAPIFactory.createWXAPI(this, APP_ID, true);
api.registerApp(APP_ID);
final SendAuth.Req req = new SendAuth.Req();
req.scope = "snsapi_userinfo";
req.state = "wechat_sdk_demo_test";
api.sendReq(req);
}
示例6: Wxpay
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
private Wxpay(Activity context) {
this.context = context;
if (mWXApi == null) {
mWXApi = WXAPIFactory.createWXAPI(context, Config.app_id);
mWXApi.registerApp(Config.app_id);
}
}
示例7: getWxApi
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
public IWXAPI getWxApi(Context context)
{
if(api == null) {
api = WXAPIFactory.createWXAPI(context, WXAPPID, false);
api.registerApp(WXAPPID);
}
return api;
}
示例8: run
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
public void run() {
if (mAction.getPayType() == Pay.PayType.APIPAY) {
PayTask payTask = new PayTask(mPay.getContext());
String mapToParameters = Utils.getMapToParameters(mPayInfo.getOrderInfo(Map.class));
Map<String, String> result = payTask.payV2(mapToParameters, false);
PayResult payResult = new PayResult(result);
if (TextUtils.equals(payResult.getResultStatus(), "9000")) {
mDispatcher.dispatchResult(Dispatcher.SUCCESS, this);
} else {
mDispatcher.dispatchResult(Dispatcher.FAILED, this);
}
} else if (mAction.getPayType() == Pay.PayType.WECHAT) {
PayReq payReq = mPayInfo.getOrderInfo(PayReq.class);
IWXAPI msgApi = WXAPIFactory.createWXAPI(mPay.getContext(), null);
msgApi.registerApp(payReq.appId);
msgApi.handleIntent(mPay.getContext().getIntent(), new IWXAPIEventHandler() {
@Override
public void onReq(BaseReq baseReq) {
}
@Override
public void onResp(BaseResp baseResp) {
}
});
}
}
示例9: onWXEntryActivityOnCreate
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
/**
* 在WXEntryActivity onCreate方法中执行
*/
public static void onWXEntryActivityOnCreate(Activity wXPayEntryActivity, IWXAPIEventHandler iwxapiEventHandler){
api = WXAPIFactory.createWXAPI(wXPayEntryActivity, null);
api.registerApp(AppConstant.APP_ID);
api.handleIntent(wXPayEntryActivity.getIntent(), iwxapiEventHandler);
}
示例10: registerWX
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
private static void registerWX(Context context) {
//
api = WXAPIFactory.createWXAPI(context, AppConstant.APP_ID, true);
api.registerApp(AppConstant.APP_ID);
if (!api.isWXAppInstalled()){
ToastUtil.showShort("您还未安装微信客户端");
}
}
示例11: onReceive
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
//通过工厂模式获取IWXAPI的实例
final IWXAPI api = WXAPIFactory.createWXAPI(context,null);
api.registerApp(AppConstant.APP_ID);
}
示例12: getWXAPIWithContext
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
public static IWXAPI getWXAPIWithContext(Context ctx) {
if (wxAPI == null && !APP_ID.isEmpty()) {
wxAPI = WXAPIFactory.createWXAPI(ctx, APP_ID, true);
}
return wxAPI;
}
示例13: onCreate
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.pay_results);
// appid需换成商户自己开放平台appid
api = WXAPIFactory.createWXAPI(this, JrmfClient.getWxAppId());
api.handleIntent(getIntent(), this);
}
示例14: onCreate
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pay_wx_result);
api = WXAPIFactory.createWXAPI(this, Constants.APP_ID);
api.handleIntent(getIntent(), this);
}
示例15: WxLoginInstance
import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
public WxLoginInstance(Activity activity, LoginListener listener, boolean fetchUserInfo) {
super(activity, listener, fetchUserInfo);
mLoginListener = listener;
mIWXAPI = WXAPIFactory.createWXAPI(activity, ShareManager.CONFIG.getWxId());
mClient = new OkHttpClient();
this.fetchUserInfo = fetchUserInfo;
}