本文整理匯總了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);
}
示例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);
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
}
示例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("沒有安裝微信應用,不能分享到朋友圈.");
}
}
示例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);
}
示例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();
}
示例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;
}
示例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();
}