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


Java WXAPIFactory.createWXAPI方法代码示例

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


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

示例1: onCreate

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
public void onCreate() {
    this.platform = (BMPlatform) this.mActivity.getIntent().getExtras().get("platform");
    this.fromShare = this.mActivity.getIntent().getExtras().getBoolean("fromShare");
    String r = m.a().r();
    c.b("MWWXEntryActivity is right, WeChatAppId = " + r);
    if (this.platform == BMPlatform.PLATFORM_WXTIMELINE) {
        this.mIWXAPI = WXAPIFactory.createWXAPI(this.mActivity, r, false);
        this.mIWXAPI.registerApp(r);
    } else {
        this.mIWXAPI = WXAPIFactory.createWXAPI(this.mActivity, r, false);
        this.mIWXAPI.registerApp(r);
    }
    if (this.mIWXAPI.isWXAppInstalled() && this.mIWXAPI.isWXAppSupportAPI()) {
        shareToWx();
        return;
    }
    Toast.makeText(this.mActivity, o.a("未安装微信或者微信版本过低。", "There is no WeChat or the version " +
            "is too low."), 0).show();
    c.d(o.a("未安装微信或者微信版本过低。", "There is no WeChat or the version is too low."));
    this.mActivity.finish();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:MWWXEntryActivity.java

示例2: shareEmoticon

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
public void shareEmoticon(Context context, String path, boolean isFriends) {
    if (api == null) {
        api = WXAPIFactory.createWXAPI(context, BuildConfig.WECHAT_APP_ID, false);
        api.registerApp(BuildConfig.WECHAT_APP_ID);
    }
    File file = new File(path);
    if (!file.exists()) {
        ToastUtil.show(context, "文件不存在");
        return;
    }
    WXEmojiObject emojiObject = new WXEmojiObject();
    emojiObject.emojiPath = path;
    WXMediaMessage msg = new WXMediaMessage(emojiObject);
    msg.description = "表情";
    //创建一个缩略图
    msg.thumbData = Util.bmpToByteArray(GlideBitmapFactory.decodeFile(path), true);
    SendMessageToWX.Req req = new SendMessageToWX.Req();
    req.transaction = "emotion" + System.currentTimeMillis();
    req.message = msg;

    req.scene = isFriends ? SendMessageToWX.Req.WXSceneTimeline : SendMessageToWX.Req.WXSceneSession;
    if (!api.sendReq(req)) {
        EventBus.getDefault().post(new EventShare(false));
        Toast.makeText(context, "分享表情失败", Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:27,代码来源:ShareManager.java

示例3: SharePopWindow

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
public SharePopWindow(Context context) {
	this.context = context;
	collectDAO = new CollectDAO(context);
	api = WXAPIFactory.createWXAPI(context, com.lling.qiqu.wxapi.Constants.APP_ID);
	LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.popup_share, null);
    view.findViewById(R.id.share_weixin).setOnClickListener(this);
    view.findViewById(R.id.share_pengyouquan).setOnClickListener(this);
    view.findViewById(R.id.share_qqfriends).setOnClickListener(this);
    view.findViewById(R.id.share_qqzone).setOnClickListener(this);
    view.findViewById(R.id.share_qqweibo).setOnClickListener(this);
    view.findViewById(R.id.share_sinaweibo).setOnClickListener(this);
    view.findViewById(R.id.share_sms).setOnClickListener(this);
    view.findViewById(R.id.share_copy).setOnClickListener(this);
    view.findViewById(R.id.share_collect).setOnClickListener(this);
	initWindow();
	this.setContentView(view);
}
 
开发者ID:liuling07,项目名称:QiQuYing,代码行数:20,代码来源:SharePopWindow.java

示例4: register

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
private boolean register() {
	if(mApi == null) {
		mApi = WXAPIFactory.createWXAPI(Const.Application, AppId, false);
		if(mApi == null) {
			return false;
		}
	}
	
	if(!mApi.registerApp(AppId)) {
		return false;
	}
	
	int wxSdkVersion = mApi.getWXAppSupportAPI();
	if (wxSdkVersion < TIMELINE_SUPPORTED_VERSION) {
		return false;
	}
	return true;
}
 
开发者ID:tassadar2002,项目名称:ouser,代码行数:19,代码来源:ShareLogic.java

示例5: WxLoginInstance

import com.tencent.mm.sdk.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:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:WxLoginInstance.java

示例6: isInstalled

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
public static boolean isInstalled(Context context, int type) {
    if (context == null)
        return false;
    IWXAPI api = WXAPIFactory.createWXAPI(context, BuildConfig.WECHAT_APP_ID, false);
    api.registerApp(BuildConfig.WECHAT_APP_ID);
    return api.isWXAppInstalled();
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:8,代码来源:ShareWechat.java

示例7: WechatLoginManager

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
public WechatLoginManager(Context context) {
    mWeChatAppId = ShareBlock.getInstance().getWechatAppId();
    if (!TextUtils.isEmpty(mWeChatAppId)) {
        mIWXAPI = WXAPIFactory.createWXAPI(context, mWeChatAppId, true);
        if (!mIWXAPI.isWXAppInstalled()) {
            Toast.makeText(context, context.getString(R.string.share_install_wechat_tips), Toast.LENGTH_SHORT).show();
            return;
        }else{
            mIWXAPI.registerApp(mWeChatAppId);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:WechatLoginManager.java

示例8: getWxApi

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
private static IWXAPI getWxApi() {
	if (sWxApi == null) {
		sWxApi = WXAPIFactory.createWXAPI(App.get(), Const.ThirdAccount.WECHAT_APP_ID, !Debug.DEBUG);	//第三个参数表示是否检查签名
		sWxApi.registerApp(Const.ThirdAccount.WECHAT_APP_ID);
	}
	return sWxApi;
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:8,代码来源:WeChat.java

示例9: onCreate

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	// acquire wxapi
	api = WXAPIFactory.createWXAPI(this, Constants.APP_ID);
	bundle = getIntent().getExtras();

	setContentView(R.layout.get_from_wx);
	initView();
}
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:12,代码来源:GetFromWXActivity.java

示例10: onCreate

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

        api.handleIntent(getIntent(), this);
    }
 
开发者ID:gyqGitHub,项目名称:WeiXinPayDemo,代码行数:10,代码来源:WXPayEntryActivity.java

示例11: onCreate

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
  public void onCreate(Bundle savedInstanceState) {
  	Log.i(TAG, "onCreate");
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_wechat_login_dialog);
  	api = WXAPIFactory.createWXAPI(this, Constants.WECHAT_APPID, false);
  	api.registerApp(Constants.WECHAT_APPID);    	
      api.handleIntent(getIntent(), this);
      it=getIntent();
      int type=0;
      if(it!=null){
      	type=it.getIntExtra(TYPE, 0);
      }
      if(type==LOGIN){
      	SendAuth.Req req = new SendAuth.Req();
      	req.scope = "snsapi_userinfo";
      	req.state = state=Long.toString(System.currentTimeMillis());
      	api.sendReq(req);
      }
      findViewById(R.id.wechat_close).setOnClickListener(new View.OnClickListener() {
	
	@Override
	public void onClick(View v) {
		finish();
	}
});
  }
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:28,代码来源:WXEntryActivity.java

示例12: onReceive

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
	final IWXAPI msgApi = WXAPIFactory.createWXAPI(context, null);

	// 将该app注册到微信
	msgApi.registerApp(Constants.APP_ID);
}
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:8,代码来源:AppRegister.java

示例13: doShareWebPage

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
private static void doShareWebPage(final String url,final String title,final String desc,final String img,final boolean timelined) {
    if(api==null) {
        api= WXAPIFactory.createWXAPI(MainApp.getContext(), APP_ID);
    }

    Bitmap bitmap= ImageUtil.getBitmap(img);
    Bitmap thumb =null;
    if(bitmap!=null){
        thumb=Bitmap.createScaledBitmap(bitmap, 64, 64, true);
    }

    WXWebpageObject webpage = new WXWebpageObject();
    webpage.webpageUrl = url;
    WXMediaMessage msg = new WXMediaMessage(webpage);
    msg.title = title;
    msg.description = desc;

    if(thumb!=null) {
        msg.thumbData = BitmapUtil.bmpToByteArray(thumb, true);
    }else{
        Bitmap thumbIcon = BitmapFactory.decodeResource(MainApp.getInstance().getResources(), R.drawable.icon);
        msg.thumbData = BitmapUtil.bmpToByteArray(thumbIcon, true);
    }

    SendMessageToWX.Req req = new SendMessageToWX.Req();
    req.transaction = buildTransaction("webpage");
    req.message = msg;
    req.scene = timelined ? SendMessageToWX.Req.WXSceneTimeline : SendMessageToWX.Req.WXSceneSession;
    api.sendReq(req);
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:31,代码来源:WeixinShareApi.java

示例14: onCreate

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	api = WXAPIFactory.createWXAPI(this, Constants.APP_ID);
	
	setContentView(R.layout.send_to_wx);
	initView();
}
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:10,代码来源:SendToWXActivity.java

示例15: onCreate

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    wxapi = WXAPIFactory.createWXAPI(this, AllShare.getWxId(), true);
    boolean registered = wxapi.registerApp(AllShare.getWxId());
    // 若是接收结果,处理完直接finish
    if (wxapi.handleIntent(intent, this)) {
        finish();
        return;
    }

    Bundle bundle;
    boolean paramError = false;
    if (!registered) {
        LogUtils.e("%s: api is null, finish.", TAG);
        paramError = true;
    } else if (null == intent || null == (bundle = intent.getExtras())) {
        LogUtils.e("%s: params is null, finish.", TAG);
        paramError = true;
    } else {
        bundle.setClassLoader(WXContent.class.getClassLoader());
        if (null == (shareContent = bundle.getParcelable(KEY_SHARE_CONTENT))) {
            LogUtils.e("%s: share content is null, finish.", TAG);
            paramError = true;
        } else if (null == (listener = bundle.getParcelable(KEY_SHARE_LISTENER))) {
            LogUtils.e("%s: result receiver is null.", TAG);
        }
    }
    if (paramError) {
        Toast.makeText(this, R.string.share_failed, Toast.LENGTH_SHORT).show();
        finish();
        return;
    }

    share();
}
 
开发者ID:szitguy,项目名称:Allshare,代码行数:38,代码来源:WXEntryActivity.java


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