當前位置: 首頁>>代碼示例>>Java>>正文


Java IWXAPI.isWXAppInstalled方法代碼示例

本文整理匯總了Java中com.tencent.mm.sdk.openapi.IWXAPI.isWXAppInstalled方法的典型用法代碼示例。如果您正苦於以下問題:Java IWXAPI.isWXAppInstalled方法的具體用法?Java IWXAPI.isWXAppInstalled怎麽用?Java IWXAPI.isWXAppInstalled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.tencent.mm.sdk.openapi.IWXAPI的用法示例。


在下文中一共展示了IWXAPI.isWXAppInstalled方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: login

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的package包/類
@Override
public void login(final Activity activity, Bundle pararms, final LoginCallback callback) {
	DebugLog.d(TAG, "login()");
	
	this.callback = callback;
	
	IWXAPI wxapi = MyApp.getApp().getWXAPI();
	if (!wxapi.isWXAppInstalled()) {
           //提醒用戶沒有安裝微信
		String uninstalled = activity.getResources().getString(R.string.WeixinLogin_uninstalled);
		CustomToast.makeText(activity,uninstalled, 2000).show();
           return;
       }
	
	 SendAuth.Req req = new SendAuth.Req();
     req.scope = "snsapi_userinfo";
     req.state = "wechat_sdk_demo";
     wxapi.sendReq(req);
}
 
開發者ID:leleliu008,項目名稱:Newton_for_Android_AS,代碼行數:20,代碼來源:WeixinLogin.java

示例2: share

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的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

示例3: isInstalled

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的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

示例4: init

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的package包/類
private IWXAPI init() {
    IWXAPI iwxapi = WXAPIFactory.createWXAPI(activity, appId, false);
    if (iwxapi.isWXAppInstalled() && iwxapi.isWXAppSupportAPI() && iwxapi.registerApp(appId)) {
        return iwxapi;
    }
    return null;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:8,代碼來源:OpenBuilder.java

示例5: onStart

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的package包/類
@Override
protected void onStart() {
    if (App.getWechatAppId() == null) {
        dispatchException();
        return;
    }
    IWXAPI api = WXAPIFactory.createWXAPI(mContext, mAppId);
    if (api == null) {
        dispatchException();
        return;
    }
    if (!api.isWXAppInstalled()) {
        dispatchException();
        return;
    }
    if (api.getWXAppSupportAPI() < Build.PAY_SUPPORTED_SDK_INT) {
        dispatchException();
        return;
    }
    api.registerApp(mAppId);
    PayReq req = new PayReq();
    req.appId = mAppId;
    req.partnerId = mPartnerId;
    req.prepayId = mPrepayId;
    req.nonceStr = mNonceStr;
    req.timeStamp = mTimeStamp;
    req.packageValue = mPackageValue;
    req.sign = mSign;
    if (mExtData != null) {
        req.extData = mExtData;
    }
    api.sendReq(req);
    WXPayBroadcast broadcast = new WXPayBroadcast(mContext);
    broadcast.setOnReceiveListener(new WXPayBroadcastReceiverListener());
    if (mContext instanceof IStoppableManager) {
        ((IStoppableManager) mContext).bind(this);
    }
    broadcast.start();
}
 
開發者ID:wavinsun,項目名稱:MUtils,代碼行數:40,代碼來源:WXPayTask.java

示例6: a

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的package包/類
private void a()
{
    IWXAPI iwxapi = WXAPIFactory.createWXAPI(this, "wx28e2610e92fbe111");
    iwxapi.registerApp("wx28e2610e92fbe111");
    if (iwxapi.isWXAppInstalled())
    {
        iwxapi.openWXApp();
    }
}
 
開發者ID:vishnudevk,項目名稱:MiBandDecompiled,代碼行數:10,代碼來源:BindWeixinActivity.java

示例7: onShareToWX

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的package包/類
public void onShareToWX(View v){
 	FmeiClient client = FmeiClient.getInstance(null);
 	IWXAPI api = WXAPIFactory.createWXAPI(getActivity(), com.emop.client.wxapi.Constants.APP_ID, 
	false);
 	
 	if(api.isWXAppInstalled() && api.isWXAppSupportAPI()){
  	String trackId = "0";
  	if(client.trackUserId != null && client.trackUserId.trim().length() > 0){
  		trackId = client.trackUserId;
  	}
	
String imageURL = String.format(Constants.WEB_SHOP_LINK, trackId, shopId, shortKey);

try{
	WXWebpageObject webObj = new WXWebpageObject(imageURL);
	
	WXMediaMessage msg = new WXMediaMessage();
	msg.mediaObject = webObj;
	msg.title = "推薦你一個好店";
	msg.description = title;
				
	msg.thumbData = getThumbData();
	
	SendMessageToWX.Req req = new SendMessageToWX.Req();
	req.transaction = buildTransaction("img");
	req.message = msg;
	api.sendReq(req);
	Log.i(Constants.TAG_EMOP, "sendReq");
	
} catch(Exception e) {
	e.printStackTrace();
}
 	}else {
 		showToast("沒有安裝微信應用,不能分享到朋友圈.");
 	}
 }
 
開發者ID:emop,項目名稱:EmopAndroid,代碼行數:37,代碼來源:ItemActionBar.java

示例8: shareToWXFriends

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的package包/類
/**
 * 分享到微信朋友圈
 * @param context
 * @param title
 * @param url
 */
public static void shareToWXFriends(Activity context,String title,String url){
	IWXAPI api = WXAPIFactory.createWXAPI(context,APP_ID,true);
    api.registerApp(APP_ID);
	// 檢查是否安裝微信
    if(!api.isWXAppInstalled()) {
    	UIHelper.ToastMessage(context, "抱歉,您尚未安裝微信客戶端,無法進行微信分享!");
    	return;
    }
    // 檢查是否支持
    if(api.getWXAppSupportAPI() < MIN_SUPPORTED_VERSION) {
    	UIHelper.ToastMessage(context, "抱歉,您的微信版本不支持分享到朋友圈!");
    	return;
    }
    WXWebpageObject webpage = new WXWebpageObject();
	webpage.webpageUrl = url;
	WXMediaMessage msg = new WXMediaMessage(webpage);
	msg.title = title;
	msg.description = "分享地址:" + url;
	// 縮略圖的二進製數據
	Bitmap thumb = BitmapFactory.decodeResource(context.getResources(), R.drawable.icon);
	msg.thumbData = bmpToByteArray(thumb, true);
	SendMessageToWX.Req req = new SendMessageToWX.Req();
	// 分享的時間
	req.transaction = String.valueOf(System.currentTimeMillis());
	req.message = msg;
	req.scene = SendMessageToWX.Req.WXSceneTimeline;
	api.sendReq(req);
}
 
開發者ID:WallaceLiu,項目名稱:oschina-android-app,代碼行數:35,代碼來源:WXFriendsHelper.java

示例9: isWeiXinInstalled

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的package包/類
@Deprecated
public static boolean isWeiXinInstalled(Context context) {
    IWXAPI api = WXAPIFactory.createWXAPI(context, ShareManager.CONFIG.getWxId(), true);
    return api.isWXAppInstalled();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:6,代碼來源:ShareUtil.java

示例10: isWXAppInstalledAndSupported

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的package包/類
/**
 * 
 * 
 * @Title: isWXAppInstalledAndSupported
 * @Description: TODO 判斷微信是否安裝
 * @author 李苜菲
 * @return
 * @return boolean
 * @throws @date
 *             2015年8月30日下午2:38:31
 */
public static boolean isWXAppInstalledAndSupported(Context context, IWXAPI api) {
	System.out.println("檢查微信是否安裝 api:" + api + "isWXAppInstalled:" + api.isWXAppInstalled() + "isWXAppSupportAPI:"
			+ api.isWXAppSupportAPI());
	boolean sIsWXAppInstalledAndSupported = api.isWXAppInstalled() && api.isWXAppSupportAPI();
	return sIsWXAppInstalledAndSupported;
}
 
開發者ID:poomoo,項目名稱:eDao,代碼行數:18,代碼來源:Utity.java

示例11: checkWechatInvalidPay

import com.tencent.mm.sdk.openapi.IWXAPI; //導入方法依賴的package包/類
/**
 * 檢測微信支付是否安裝
 * @param context
 * @param app_id
 * @return
 */
public static boolean checkWechatInvalidPay(final Context context, String app_id) {
    IWXAPI iwxapi = WXAPIFactory.createWXAPI(context, app_id);
    return iwxapi.isWXAppInstalled();

}
 
開發者ID:Dr-Kalen,項目名稱:MobilePayLibrary,代碼行數:12,代碼來源:MobilePayTool.java


注:本文中的com.tencent.mm.sdk.openapi.IWXAPI.isWXAppInstalled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。