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


Java WXAPIFactory类代码示例

本文整理汇总了Java中com.tencent.mm.opensdk.openapi.WXAPIFactory的典型用法代码示例。如果您正苦于以下问题:Java WXAPIFactory类的具体用法?Java WXAPIFactory怎么用?Java WXAPIFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WXAPIFactory类属于com.tencent.mm.opensdk.openapi包,在下文中一共展示了WXAPIFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: WXBase

import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入依赖的package包/类
protected WXBase(Activity activity, Platform platform) {
    mActivity = activity;
    mPlatform = platform;
    if (!TextUtils.isEmpty(platform.getAppId())) {
        mApi = WXAPIFactory.createWXAPI(activity.getApplicationContext(), platform.getAppId(), true);
        mApi.registerApp(platform.getAppId());
    }
    services.put(this, true);
}
 
开发者ID:czy1121,项目名称:sdk3rd,代码行数:10,代码来源:WXBase.java

示例4: 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

示例5: 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

示例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: onCreate

import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入依赖的package包/类
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.pay_result);
      
  	api = WXAPIFactory.createWXAPI(this, Constant.APP_ID);
      api.handleIntent(getIntent(), this);

EventBus.getDefault().register(this);
  }
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:11,代码来源:WXPayEntryActivity.java

示例8: 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

示例9: 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

示例10: 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

示例11: getWXAPI

import com.tencent.mm.opensdk.openapi.WXAPIFactory; //导入依赖的package包/类
/**
 * Get weixin api
 * @return wxAPI
 */
public IWXAPI getWXAPI() {
    if (wxAPI == null && !APP_ID.isEmpty()) {
        wxAPI = WXAPIFactory.createWXAPI(mContext, APP_ID, true);
    }

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


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