ipika july Member Licensed User Longtime User May 15, 2014 #1 Hi, This is my first post. I was trying to make an application which is active while we are on call. I found phone state listener library which helped me. But in few application broadcast wasn't there while call was disconnected. So i found a method getCallState() from http://developer.android.com/reference/android/telephony/TelephonyManager.html#getCallState() which i want to use in B4A. i tried reflection library but code throws nullpointerexception erro Code: Copy Dim r As Reflector r.Target = r.GetContext Dim TelephonyManager As Object TelephonyManager = r.RunMethod2("getSystemService", "telephony", "java.lang.String") r.Target = TelephonyManager Log(r.runPublicMethod("getCallState",null,null))
Hi, This is my first post. I was trying to make an application which is active while we are on call. I found phone state listener library which helped me. But in few application broadcast wasn't there while call was disconnected. So i found a method getCallState() from http://developer.android.com/reference/android/telephony/TelephonyManager.html#getCallState() which i want to use in B4A. i tried reflection library but code throws nullpointerexception erro Code: Copy Dim r As Reflector r.Target = r.GetContext Dim TelephonyManager As Object TelephonyManager = r.RunMethod2("getSystemService", "telephony", "java.lang.String") r.Target = TelephonyManager Log(r.runPublicMethod("getCallState",null,null))
bsnqt Active Member Licensed User Longtime User May 16, 2014 #2 I suggest you may use BroadcastReceiver. Upvote 0
ipika july Member Licensed User Longtime User May 16, 2014 #3 As i told i have used broadcast receiver but there exist some issue. & i cannot find samples/tutorial of reflection library so i cannot do more. i updated code but still it throws error Code: Copy Dim r As Reflector r.Target = r.GetContext r.Target = r.RunMethod2("getSystemService", "telephony", "java.lang.String") Log(r.RunMethod("getCallState")) Last edited: May 16, 2014 Upvote 0
As i told i have used broadcast receiver but there exist some issue. & i cannot find samples/tutorial of reflection library so i cannot do more. i updated code but still it throws error Code: Copy Dim r As Reflector r.Target = r.GetContext r.Target = r.RunMethod2("getSystemService", "telephony", "java.lang.String") Log(r.RunMethod("getCallState"))
ipika july Member Licensed User Longtime User May 16, 2014 #4 Ok. I found the issue. it is not telephony it is phone. Now it is working Upvote 0