i dont speak english well…
i need Phone Call.
so, add in org.cocos2dx.lib/Cocos2dxActivity.java
@ public void Calling(String number)
{
Intent intent = new Intent (Intent.ACTION_DIAL,Uri.parse(“tel:” + number));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}@
and
C++ file add in CCApplication_android.cpp
void CCApplication::Calling(const char* _number)
{
JniMethodInfo methodInfo;
*cocos2d::CCLog("start Calling");*
if (! JniHelper::getMethodInfo(methodInfo,"org/cocos2dx/lib/Cocos2dxActivity", "Calling", "(Ljava/lang/String)V"))
{
CCLOG("%s %d: error to get methodInfo", __FILE__, __LINE__);
}
else
{
jstring stringArg1 = methodInfo.env->NewStringUTF(_number);
methodInfo.env->CallVoidMethod(methodInfo.classID, methodInfo.methodID,stringArg1);
methodInfo.env->DeleteLocalRef(stringArg1);
}
}
i use it,
CCApplication::sharedApplication().Calling(m_phoneNumber);
//
but, app crash T_T
simulator LogCat error code;
CCLog(“start Calling”); work well!
04-02 19:35:34.380: D/cocos2d-x debug info(637): start Calling
04-02 19:35:34.380: W/dalvikvm(637): JNI WARNING: expected return type 'I'
04-02 19:35:34.380: W/dalvikvm(637): calling Lorg/cocos2dx/lib/Cocos2dxActivity;.Calling (Ljava/lang/String)V)V
04-02 19:35:34.390: W/dalvikvm(637): in Lorg/cocos2dx/lib/Cocos2dxRenderer;.nativeTouchesBegin:(IFF)V (CallStaticIntMethodV)
04-02 19:35:34.390: I/dalvikvm(637): "GLThread 80" prio=5 tid=13 NATIVE
04-02 19:35:34.390: I/dalvikvm(637): | group="main" sCount=0 dsCount=0 obj=0x412aea58 self=0x1afff0
04-02 19:35:34.390: I/dalvikvm(637): | sysTid=653 nice=0 sched=0/0 cgrp=default handle=1770560
04-02 19:35:34.400: I/dalvikvm(637): | schedstat=( 8864835662 3598031144 646 ) utm=868 stm=18 core=0
04-02 19:35:34.400: I/dalvikvm(637): at org.cocos2dx.lib.Cocos2dxRenderer.nativeTouchesBegin(Native Method)
04-02 19:35:34.400: I/dalvikvm(637): at org.cocos2dx.lib.Cocos2dxRenderer.handleActionDown(Cocos2dxRenderer.java:74)
04-02 19:35:34.400: I/dalvikvm(637): at org.cocos2dx.lib.Cocos2dxGLSurfaceView$7.run(Cocos2dxGLSurfaceView.java:308)
04-02 19:35:34.400: I/dalvikvm(637): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1424)
04-02 19:35:34.400: I/dalvikvm(637): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)
04-02 19:35:34.410: E/dalvikvm(637): VM aborting
04-02 19:35:34.410: A/libc(637): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)@
What’s the problem?
Help me.