修复稳定
This commit is contained in:
@@ -48,7 +48,7 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
|
||||
//public static final String AppSecret = "85dda78b3fdf3cb6619526fabf089863";
|
||||
|
||||
|
||||
// IWXAPI 鏄涓夋柟app鍜屽井淇¢<EFBFBD>氫俊鐨刼penapi鎺ュ彛
|
||||
// IWXAPI 是第三方app和微信通信的openapi接口
|
||||
private static IWXAPI api;
|
||||
|
||||
private static final int SceneSession = 0;
|
||||
@@ -72,9 +72,9 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
||||
// 閫氳繃WXAPIFactory宸ュ巶锛岃幏鍙朓WXAPI鐨勫疄渚<EFBFBD>
|
||||
// 通过WXAPIFactory工厂,获取IWXAPI的实例
|
||||
api = WXAPIFactory.createWXAPI(this,APP_ID, true);
|
||||
// 灏嗚app娉ㄥ唽鍒板井淇<EFBFBD>
|
||||
// 将该app注册到微信
|
||||
api.registerApp(APP_ID);
|
||||
api.handleIntent(intent, this);
|
||||
|
||||
@@ -136,14 +136,22 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
|
||||
if (!file.exists())
|
||||
{
|
||||
Log.d(Tag,"reqShare file not exists:"+ImgPath);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
Bitmap bmp = BitmapFactory.decodeFile(ImgPath);
|
||||
if (bmp == null) {
|
||||
Log.e(Tag, "reqShare decode bitmap failed: " + ImgPath);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// 璁$畻缂╂斁姣斾緥
|
||||
// 计算缩放比例
|
||||
int scaleWidth = (int)(bmp.getWidth() * 0.5);
|
||||
int scaleHeight = (int)(bmp.getHeight() * 0.5);
|
||||
if (scaleWidth <= 0) scaleWidth = 1;
|
||||
if (scaleHeight <= 0) scaleHeight = 1;
|
||||
Bitmap newBmp = Bitmap.createScaledBitmap(bmp, scaleWidth, scaleHeight, true);
|
||||
WXImageObject imgObj = new WXImageObject(newBmp);
|
||||
|
||||
@@ -257,7 +265,7 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
|
||||
Log.d(Tag,"reqShareTxtCB Ok:"+text);
|
||||
}
|
||||
|
||||
// 寰俊鍙戦<EFBFBD>佽姹傚埌绗笁鏂瑰簲鐢ㄦ椂锛屼細鍥炶皟鍒拌鏂规硶
|
||||
// 微信发送请求到第三方应用时,会回调到该方法
|
||||
@Override
|
||||
public void onReq(BaseReq req)
|
||||
{
|
||||
@@ -277,7 +285,7 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
|
||||
Log.d(Tag,"onReq:"+req.getType());
|
||||
}
|
||||
|
||||
// 绗笁鏂瑰簲鐢ㄥ彂閫佸埌寰俊鐨勮姹傚鐞嗗悗鐨勫搷搴旂粨鏋滐紝浼氬洖璋冨埌璇ユ柟娉<EFBFBD>
|
||||
// 第三方应用发送到微信的请求处理后的响应结果,会回调到该方法
|
||||
@Override
|
||||
public void onResp(BaseResp resp) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user