Hi all i have this code:
compile and when start app i have this error:
Any idea ?
Thanks
B4X:
....
If FirstTime Then
NativeMe.InitializeContext
EndIf
Dim w AsBoolean
w = NativeMe.RunMethod("isInstalled", Null) ' <----- I think that i have here ERROR
Log("Whatsapp " & w)
......
#If JAVA
import java.io.File;
import android.content.Context;
import java.util.ArrayList;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.util.Log;
private final static String WHATSSAP_APP_ID = "com.whatsapp";
private final static boolean DEBUG = false;
public final static int IMAGE_TYPE = 0;
public final static int AUDIO_TYPE = 1;
public final static int VIDEO_TYPE = 2;
public final static boolean isInstalled(Context context){
Boolean installed = false;
try{
PackageManager mPm = context.getPackageManager();
PackageInfo info = mPm.getPackageInfo(WHATSSAP_APP_ID, 0);
installed = info != null;
}catch(Exception e){
installed = false;
if(DEBUG) Log.e("Exception", e.toString());
}
return installed;
}
#End If
B4X:
** Activity (main) Create, isFirst = true **
java.lang.RuntimeException: Method: isInstalled not matched.
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:128)
at b4a.example.main._activity_create(main.java:351)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at b4a.example.main.afterFirstLayout(main.java:112)
at b4a.example.main.access$100(main.java:29)
at b4a.example.main$WaitForLayout.run(main.java:90)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Method: isInstalled not matched.
Thanks