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


Java WXAPIFactory类代码示例

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


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

示例1: isWeixinSupportJump

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
public static boolean isWeixinSupportJump(Context context)
{
    if (WXAPIFactory.createWXAPI(context, "wx28e2610e92fbe111").isWXAppInstalled())
    {
        int j;
        try
        {
            j = context.getPackageManager().getPackageInfo("com.tencent.mm", 0).versionCode;
        }
        catch (android.content.pm.PackageManager.NameNotFoundException namenotfoundexception)
        {
            return false;
        }
        if (j >= 480)
        {
            return true;
        }
    }
    return false;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:21,代码来源:Utils.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: 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

示例4: getIwxapiInstance

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
private synchronized IWXAPI getIwxapiInstance() {
    if (iwxapi == null && mPayModel != null) {
        MPayWeChatModel mPayWeChatModel = (MPayWeChatModel) mPayModel;
        if (mPayWeChatModel != null
                && mPayWeChatModel.getAppId() != null
                && !mPayWeChatModel.getAppId().equals("")
                ) {
            iwxapi = WXAPIFactory.createWXAPI(context, mPayWeChatModel.getAppId());
            MPayConfig.WE_CHAT_PAY_APP_ID = mPayWeChatModel.getAppId();
        }
    }
    if (iwxapi == null) {
        Log.e(TAG, "iwxapi is null ! iwxapi instance is failure !");
    }
    return iwxapi;
}
 
开发者ID:MrxMo,项目名称:MPay,代码行数:17,代码来源:MPayWeChat.java

示例5: onWechatLogin

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
/**
 * 微信授权登录
 */
@Click(R.id.llWechatLogin)
void onWechatLogin() {
  /*  Log.i("LoginActivity", "微信授权登录");
    //AbToastUtil.showToast(mContext,"功能正在完善开发中...");
    Config.dialog = ProgressDialog.show(mContext, "提示", "正在请求跳转....");
    SHARE_MEDIA platform = SHARE_MEDIA.WEIXIN;
    umShareAPI = UMShareAPI.get(mContext);
    umShareAPI.doOauthVerify(this, platform, umAuthListener);*/
    if (Contact.isWeixinAvilible(this)) {
        progressDialog = AbDialogUtil.showProgressDialog(mContext, Global.LOADING_PROGRESSBAR_ID, "登录中");
        mLlWechatLogin.setEnabled(false);
        IWXAPI api = WXAPIFactory.createWXAPI(this, "wx747d053fa471eb15", true);

        api.registerApp("wx747d053fa471eb15");
        SendAuth.Req req = new SendAuth.Req();
        req.scope = "snsapi_userinfo";
        req.state = "wechat_sdk_demo_test";
        api.sendReq(req);
    } else {
        ToastUtils.show(this, "请安装微信");
    }
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:26,代码来源:LoginActivity.java

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

示例7: sendPayRequestByWechat

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
private void sendPayRequestByWechat(PayInfo payInfo) {
    if(payInfo == null) {
        return;
    }

    IWXAPI api = WXAPIFactory.createWXAPI(mContext, payInfo.getAppId());
    PayReq payReq = new PayReq();
    payReq.appId = payInfo.getAppId();
    payReq.partnerId = payInfo.getPartnerId();
    payReq.prepayId = payInfo.getPrepayId();
    payReq.nonceStr = payInfo.getNonceStr();
    payReq.timeStamp = payInfo.getTimeStamp();
    payReq.packageValue = payInfo.getPackageValue();
    payReq.sign = payInfo.getSign();
    api.sendReq(payReq);
}
 
开发者ID:g977284333,项目名称:KwPresent,代码行数:17,代码来源:PayManager.java

示例8: share

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
@Override
public void share() {
    if (App.getWechatAppId() == null) {
        if (mListener != null) {
            mListener.onError(this);
        }
    }
    IWXAPI api = WXAPIFactory.createWXAPI(mContext, App.getWechatAppId(), false);
    if (!api.isWXAppInstalled()) {
        if (mListener != null) {
            mListener.onError(this);
        }
        return;
    }
    WXWebpageObject web = new WXWebpageObject();
    web.webpageUrl = mUrl;
    WXMediaMessage msg = new WXMediaMessage(web);
    msg.title = mTitle;
    msg.description = mText;
    msg.thumbData = AppUtil.toByteArray(AppUtil.getAppIcon(mContext));
    SendMessageToWX.Req req = new SendMessageToWX.Req();
    req.transaction = TRANSACTION + System.currentTimeMillis();
    req.message = msg;
    req.scene = getScene();
    api.sendReq(req);
}
 
开发者ID:wavinsun,项目名称:MUtils,代码行数:27,代码来源:ShareWechatImpl.java

示例9: onCreate

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_informscontent);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    pref = PreferenceManager.getDefaultSharedPreferences(this);
    api = WXAPIFactory.createWXAPI(this, APP_ID);
    api.registerApp(APP_ID);
    listView = (ListView) findViewById(R.id.listView);
    listItems = new ArrayList<>();

    initNewsHeader();

    listView.addHeaderView(headView, null, true);
    listView.setAdapter(simpleAdapter);
}
 
开发者ID:lin2020,项目名称:csapp,代码行数:22,代码来源:InformsContentActivity.java

示例10: onCreate

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_newscontent);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    api = WXAPIFactory.createWXAPI(this, APP_ID);
    api.registerApp(APP_ID);
    listView = (ListView) findViewById(R.id.listView);
    listItems = new ArrayList<>();
    pref = PreferenceManager.getDefaultSharedPreferences(this);

    new Thread() {
        public void run() {
            new AnotherTask().execute("JSON");
        }
    }.start();
}
 
开发者ID:lin2020,项目名称:csapp,代码行数:23,代码来源:NewsContentActivity.java

示例11: onCreate

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_noticescontent);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    pref = PreferenceManager.getDefaultSharedPreferences(this);
    api = WXAPIFactory.createWXAPI(this, APP_ID);
    api.registerApp(APP_ID);
    listView = (ListView) findViewById(R.id.listView);
    listItems = new ArrayList<>();

    initNewsHeader();

    listView.addHeaderView(headView, null, true);
    listView.setAdapter(simpleAdapter);
}
 
开发者ID:lin2020,项目名称:csapp,代码行数:21,代码来源:NoticesContentActivity.java

示例12: onCreate

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
protected void onCreate(Bundle bundle)
{
    super.onCreate(bundle);
    setContentView(0x7f030001);
    e = (Button)findViewById(0x7f0a0028);
    e.setOnClickListener(this);
    h = findViewById(0x7f0a002a);
    f = (TextView)findViewById(0x7f0a002b);
    f.setOnClickListener(this);
    i = findViewById(0x7f0a002c);
    j = (ImageView)findViewById(0x7f0a002d);
    k = (TextView)findViewById(0x7f0a002f);
    g = new E(this);
    EventBus.getDefault().register(this, "onBleStatusChanged", cn/com/smartdevices/bracelet/ui/BaseSCActivity$ConnStatus, new Class[0]);
    l = WXAPIFactory.createWXAPI(this, "wx28e2610e92fbe111");
    l.registerApp("wx28e2610e92fbe111");
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:18,代码来源:BindWeixinActivityNew.java

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

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

示例15: initWeixinShare

import com.tencent.mm.sdk.openapi.WXAPIFactory; //导入依赖的package包/类
private void initWeixinShare(Context context) {
    mIWXAPI = WXAPIFactory.createWXAPI(context, mWeChatAppId, true);
    if (!mIWXAPI.isWXAppInstalled()) {
        Toast.makeText(context, context.getString(R.string.share_install_wechat_tips), Toast.LENGTH_SHORT).show();
    }else{
        mIWXAPI.registerApp(mWeChatAppId);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:WechatShareManager.java


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