当前位置: 首页>>代码示例>>Java>>正文


Java WXAPIFactory.createWXAPI方法代码示例

本文整理汇总了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();
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:17,代码来源:PayWXStart.java

示例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;
}
 
开发者ID:shawnsky,项目名称:RantApp,代码行数:30,代码来源:RantActivity.java

示例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);
    }
 
开发者ID:penghuanliang,项目名称:Rxjava2.0Demo,代码行数:9,代码来源:WXEntryActivity.java

示例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();
}

  }
 
开发者ID:stdnull,项目名称:RunMap,代码行数:12,代码来源:WXEntryActivity.java

示例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);
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:14,代码来源:ImportScoreActivity.java

示例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);
    }
}
 
开发者ID:Jamling,项目名称:af-pay,代码行数:8,代码来源:Wxpay.java

示例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;
}
 
开发者ID:wanliyang1990,项目名称:AppServiceRestFul,代码行数:9,代码来源:WxFactory.java

示例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) {

            }
        });
    }
}
 
开发者ID:egzosn,项目名称:pay-java-android,代码行数:30,代码来源:PayHunter.java

示例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);
}
 
开发者ID:haihaio,项目名称:AmenWeather,代码行数:11,代码来源:WXEntryActivityUtils.java

示例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("您还未安装微信客户端");
    }
}
 
开发者ID:haihaio,项目名称:AmenWeather,代码行数:10,代码来源:WXEntryActivityUtils.java

示例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);
}
 
开发者ID:haihaio,项目名称:AmenWeather,代码行数:8,代码来源:WeChatAppRegister.java

示例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;
}
 
开发者ID:natjs,项目名称:nat-wechat,代码行数:8,代码来源:WechatModule.java

示例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);
    }
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:10,代码来源:WXPayEntryActivity.java

示例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);
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:9,代码来源:WXPayEntryActivity.java

示例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;
}
 
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:8,代码来源:WxLoginInstance.java


注:本文中的com.tencent.mm.opensdk.openapi.WXAPIFactory.createWXAPI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。