给微信发消息时,如何设置titanium中的Activity?

how to set the Activity in titanium when I send message to wechat?

我已经注册成功了。我现在想发消息给微信,但是我发生了:

[ERROR] E/MicroMsg.SDK.MMessageAct: send fail, target ActivityNotFound

这是我的android模块(src//.java)代码:

 @Kroll.method
  public void regToWx()
  {
    Log.d(current_module, "=======start to register to wechat==========");
    api = WXAPIFactory.createWXAPI(getActivity(),null);
    Log.d(current_module, "=======create api after====="+api);
    api.registerApp(APP_ID);
    Log.d(current_module, "====注册微信成功======");
  }
  @Kroll.method
  public void sendMessageToWx()
  {
    Log.d(current_module, "====下面发送消息给微信======");
    WXTextObject text_obj = new WXTextObject();
    text_obj.text="we are young!!!";
    Log.d(current_module, "====构造Media Message======");
    WXMediaMessage msg_obj = new WXMediaMessage();
    msg_obj.mediaObject = text_obj;
    msg_obj.description = "this is desciption";
    Log.d(current_module, "====构造 Request======");
    SendMessageToWX.Req req = new SendMessageToWX.Req();
    req.transaction = String.valueOf(System.currentTimeMillis());
    req.message = msg_obj;
    req.scene = SendMessageToWX.Req.WXSceneTimeline;
    Log.d(current_module, "====发送请求给微信了======");
    boolean result = api.sendReq(req);
    Log.d(current_module, "====result======"+result);
    Activity activity = TiApplication.getInstance().getCurrentActivity();
    Log.d(current_module, activity.toString());
  }

这是我的 test_app

<activity android:name="com.happysoft.testmodule.TestModuleModule" android:exported="true" android:label="@string/app_name"></activity>

我解决了这个麻烦

@Kroll.onAppCreate
  public static void onAppCreate(TiApplication app)
  {
    Log.d(LCAT, "inside onAppCreate");
    api = WXAPIFactory.createWXAPI(app,APP_ID,true);
    api.registerApp(APP_ID);
    Log.d(LCAT, "================= register App success=====================");

  }