com.tencent.mm.sdk.openapi.IWXAPI Java Examples

The following examples show how to use com.tencent.mm.sdk.openapi.IWXAPI. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WXEntryActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	IWXAPI api = WXAPIFactory.createWXAPI(this, GosDeploy.setWechatAppID(),
			true);
	api.handleIntent(getIntent(), this);
}
 
Example #2
Source File: WeChat.java    From ESSocialSDK with Apache License 2.0 5 votes vote down vote up
public static IWXAPI getIWXAPIInstance(Context context, String appId) {
    if (null == api) {
        api = WXAPIFactory.createWXAPI(context, appId, true);
        api.registerApp(appId);
    }

    return api;
}
 
Example #3
Source File: SharePanelView.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
public static IWXAPI getIWXAPI(){
    if(iwxapi == null){
        iwxapi = WXAPIFactory.createWXAPI(MyApp.getInstance().getApplicationContext(),WECHAT_APP_ID,true);
        iwxapi.registerApp(WECHAT_APP_ID);
    }
    return iwxapi;
}
 
Example #4
Source File: WXCallbackActivity.java    From ESSocialSDK with Apache License 2.0 5 votes vote down vote up
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    setIntent(intent);
    IWXAPI api = WeChat.getIWXAPIInstance();
    if (null != api)
        api.handleIntent(intent, this);
}
 
Example #5
Source File: AppRegister.java    From wechatsdk-xamarin with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
	final IWXAPI api = WXAPIFactory.createWXAPI(context, null);

	// ����appע�ᵽ΢��
	api.registerApp(Constants.APP_ID);
}
 
Example #6
Source File: BindWeixinActivity.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private void a()
{
    IWXAPI iwxapi = WXAPIFactory.createWXAPI(this, "wx28e2610e92fbe111");
    iwxapi.registerApp("wx28e2610e92fbe111");
    if (iwxapi.isWXAppInstalled())
    {
        iwxapi.openWXApp();
    }
}
 
Example #7
Source File: OnekeyShare.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
private void shareToWechat(boolean isWechatMoments,boolean isWechat, boolean isWechatFavorite, String imagePath, String comment) {
	IWXAPI api = WXAPIFactory.createWXAPI(MyApp.getInstance(), MyApp.WEIXIN_KEY);
	// 将该app注册到微信
       api.registerApp( MyApp.WEIXIN_KEY);
	WXImageObject imgObj = new WXImageObject();
	imgObj.setImagePath(imagePath);
	
	WXMediaMessage msg = new WXMediaMessage();
	msg.description = comment;
	msg.mediaObject = imgObj;
	
	Bitmap bmp = BitmapFactory.decodeFile(imagePath);
	Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 100, 100, true);
	bmp.recycle();
	msg.thumbData = bmpToByteArray(thumbBmp, true);
	int imageSize = msg.thumbData.length / 1024;
       if (imageSize > 32) {
               Toast.makeText(MyApp.getInstance(), "您分享的图片过大", Toast.LENGTH_SHORT)
                               .show();
               return;
       }
	SendMessageToWX.Req req = new SendMessageToWX.Req();
	req.transaction = buildTransaction("img");
	req.message = msg;
	req.scene = isWechat? SendMessageToWX.Req.WXSceneSession:SendMessageToWX.Req.WXSceneTimeline;
	api.sendReq(req);
	finish();
}
 
Example #8
Source File: ShareFragment.java    From Sky31Radio with Apache License 2.0 4 votes vote down vote up
private void sendRequestToWX(final int scene){
    picasso.load(sharingProgram.getThumbnail())
            .into(new Target() {
                @Override
                public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                    byte[] data = BitmapUtils.encodeToByteArray(bitmap);
                    this.sendRequest(data);
                }

                @Override
                public void onBitmapFailed(Drawable errorDrawable) {
                    this.sendRequest(null);
                }

                @Override
                public void onPrepareLoad(Drawable placeHolderDrawable) {

                }
                private void sendRequest(byte[] thumbData){
                    IWXAPI iwxapi = WXAPIFactory.createWXAPI(getActivity(), BuildConfig.WECHAT_APP_ID, true);
                    iwxapi.registerApp(BuildConfig.WECHAT_APP_ID);

                    WXMusicObject object = new WXMusicObject();
                    object.musicUrl = BuildConfig.APP_DOWNLOAD_URL;
                    object.musicDataUrl = sharingProgram.getAudio().getSrc();
                    object.musicLowBandUrl = sharingProgram.getThumbnail();
                    object.musicLowBandDataUrl = sharingProgram.getThumbnail();
                    WXMediaMessage message = new WXMediaMessage();
                    message.mediaObject = object;
                    message.title = sharingProgram.getTitle();
                    message.description = getString(R.string.tpl_wx_share_description,
                            getString(R.string.app_name),
                            sharingProgram.getAuthor());
                    message.thumbData  = thumbData;

                    SendMessageToWX.Req request = new SendMessageToWX.Req();
                    request.message = message;
                    request.transaction = String.valueOf(System.currentTimeMillis());
                    request.scene = scene;

                    iwxapi.sendReq(request);
                    iwxapi.unregisterApp();
                }
            });

}
 
Example #9
Source File: WXEntryActivity.java    From gokit-android with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	IWXAPI api = WXAPIFactory.createWXAPI(this, GosDeploy.setWechatAppID(), true);
	api.handleIntent(getIntent(), this);
}
 
Example #10
Source File: WeChat.java    From ESSocialSDK with Apache License 2.0 4 votes vote down vote up
public static IWXAPI getIWXAPIInstance() {
    return api;
}
 
Example #11
Source File: WXCallbackActivity.java    From ESSocialSDK with Apache License 2.0 4 votes vote down vote up
private void handleIntent(Intent intent) {
    IWXAPI api = WeChat.getIWXAPIInstance();
    if (null != api)
        api.handleIntent(intent, this);
}
 
Example #12
Source File: BindWeixinActivityNew.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
static IWXAPI d(BindWeixinActivityNew bindweixinactivitynew)
{
    return bindweixinactivitynew.l;
}
 
Example #13
Source File: WXEntryActivity.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
static IWXAPI a(WXEntryActivity wxentryactivity)
{
    return wxentryactivity.c;
}
 
Example #14
Source File: WXEntryActivity.java    From Gizwits-SmartBuld_Android with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	IWXAPI api = WXAPIFactory.createWXAPI(this, GosDeploy.setWechatAppID(), true);
	api.handleIntent(getIntent(), this);
}
 
Example #15
Source File: QuShiDetailActivity.java    From QiQuYing with Apache License 2.0 4 votes vote down vote up
private void initWeiXin() {
	IWXAPI api = WXAPIFactory.createWXAPI(this, com.lling.qiqu.wxapi.Constants.APP_ID);
	api.registerApp(com.lling.qiqu.wxapi.Constants.APP_ID);
}
 
Example #16
Source File: SplashActivity.java    From QiQuYing with Apache License 2.0 4 votes vote down vote up
private void initWeiXin() {
	IWXAPI api = WXAPIFactory.createWXAPI(this, com.lling.qiqu.wxapi.Constants.APP_ID);
	api.registerApp(com.lling.qiqu.wxapi.Constants.APP_ID);
}
 
Example #17
Source File: TuDetailActivity.java    From QiQuYing with Apache License 2.0 4 votes vote down vote up
private void initWeiXin() {
	IWXAPI api = WXAPIFactory.createWXAPI(this,
			com.lling.qiqu.wxapi.Constants.APP_ID);
	api.registerApp(com.lling.qiqu.wxapi.Constants.APP_ID);
}
 
Example #18
Source File: WXPay.java    From PayAndroid with Apache License 2.0 4 votes vote down vote up
public IWXAPI getWXApi() {
    return mWXApi;
}
 
Example #19
Source File: ShareUtil.java    From ShareUtil with Apache License 2.0 4 votes vote down vote up
@Deprecated
public static boolean isWeiXinInstalled(Context context) {
    IWXAPI api = WXAPIFactory.createWXAPI(context, ShareManager.CONFIG.getWxId(), true);
    return api.isWXAppInstalled();
}
 
Example #20
Source File: XmPluginHostApi.java    From NewXmPluginSDK with Apache License 2.0 2 votes vote down vote up
/**
 * 在ApiLevel:25后升级了微信sdk,有用到这个接口的必须更新插件sdk适配,发布新版插件并且修改minPluginSdkApiVersion为25 ApiLevel:20
 * 创建米家app注册的微信接口
 */
public abstract IWXAPI createWXAPI(Context context, boolean bl);