This constant was deprecated in API level 23.
This settings is not used anymore.
Setting to allow mock locations and location provider status to be injected into the LocationManager service for testing purposes during application development. These locations and status values override actual location and status information generated by network, gps, or other location providers.
Public Sub isLocationFromMockProvider(location1 As Location) As Boolean
return nativeMe.RunMethod("isLocationFromMockProvider", Array(GetContext, location1))
End Sub
#Region Subs für Mocklocation
#If JAVA
import android.provider.Settings;
import android.provider.Settings.Secure;
import android.content.Context;
import android.test.mock.MockContext;
import android.location.Location;
public static boolean isLocationFromMockProvider(Context context, Location location) {
boolean isMock = false;
if (android.os.Build.VERSION.SDK_INT >= 23) {
isMock = location.isFromMockProvider();
return isMock;
} else {
if (Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ALLOW_MOCK_LOCATION).equals("0"))
return false;
else {
return true;
}
}
}
#End If
Private Sub GetContext As JavaObject
Return GetBA.GetField("context")
End Sub
Private Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetFieldJO("processBA")
End Sub
Hi,
Unfortunately, this does not work anymore, when compiling comes this error message.
Does anyone know a solution?
B4A Version: 8.50
Parsing code. (0.19s)
Building folders structure. (0.33s)
Compiling code. (0.40s)
Compiling layouts code. (0.05s)
Organizing libraries. (0.00s)
Generating R file. (1.09s)
Compiling generated Java code. Error
javac 1.8.0_60
src\fg\GPSTimekeeper_client\starter.java:6: error: package android.test.mock does not exist
import android.test.mock.MockContext;
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
If I delete this line then the app crashes with this error message.
*** Service (starter) Create ***
** Service (starter) Start **
onAuthStateChanged: com.google.firebase.auth.internal.zzj@10463e6
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for fg.GPSTimekeeper_client
Subscriptions AVAILABLE.
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
true, Setup successful. (response: 0:OK)
Subscriptions supported: true
Starting async operation: refresh inventory
Querying owned items, item type: inapp
Package name: fg.GPSTimekeeper_client
Calling getPurchases with continuation token: null
Owned items response: 0
Continuation token: null
Querying SKU details.
queryPrices: nothing to do because there are no SKUs.
Querying owned items, item type: subs
Package name: fg.GPSTimekeeper_client
Calling getPurchases with continuation token: null
Owned items response: 0
Continuation token: null
Querying SKU details.
queryPrices: nothing to do because there are no SKUs.
Ending async operation: refresh inventory
purchases=(MyMap) {}
starter_islocationfrommockprovider (java line: 692)
java.lang.RuntimeException: Method: isLocationFromMockProvider not found in: android.app.Application
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:366)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:119)
at fg.GPSTimekeeper_client.starter._islocationfrommockprovider(starter.java:692)
at fg.GPSTimekeeper_client.starter._gps1_locationchanged(starter.java:638)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.gps.GPS$1.onLocationChanged(GPS.java:65)
at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:281)
at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:210)
at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:226)
at android.os.Handler.dispatchMessage(Handler.java:102)
at anywheresoftware.b4a.Msgbox.waitForMessage(Msgbox.java:231)
at anywheresoftware.b4a.Msgbox.msgbox(Msgbox.java:170)
at anywheresoftware.b4a.keywords.Common.Msgbox2(Common.java:443)
at anywheresoftware.b4a.keywords.Common.Msgbox(Common.java:422)
at fg.GPSTimekeeper_client.main._btnregister_click(main.java:913)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:5197)
at android.view.View$PerformClick.run(View.java:20926)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)