Hello everyone
I'm trying to figure how to get gsf id key . I tried this method and writed it as shown bellow.
but i am getting an error :
cannot find symbol
public String getGsfAndroidId(Context context)
I also put this <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> at manifest
Any ideas please?
I'm trying to figure how to get gsf id key . I tried this method and writed it as shown bellow.
B4XmainPage:
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
#If JAVA
public String getGsfAndroidId(Context context)
{
Uri URI = Uri.parse("content://com.google.android.gsf.gservices");
String ID_KEY = "android_id";
String params[] = {ID_KEY};
Cursor c = context.getContentResolver().query(URI, null, null, params, null);
if (!c.moveToFirst() || c.getColumnCount() < 2)
return null;
try
{
return Long.toHexString(Long.parseLong(c.getString(1)));
}
catch (NumberFormatException e)
{
return null;
}
}
#End If
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
End Sub
Public Sub Initialize
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
Sub Button1_Click
xui.MsgboxAsync(getGsf, "B4X")
End Sub
Private Sub getGsf As String
Dim jo As JavaObject = Me
Dim str As String = jo.RunMethod("getGsfAndroidId", Null)
Return str
End Sub
but i am getting an error :
cannot find symbol
public String getGsfAndroidId(Context context)
B4A Version: 10.2
Java Version: 11
Parsing code. (0.05s)
Building folders structure. (0.03s)
Running custom action. (0.06s)
Compiling code. (0.21s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling debugger engine code. (0.01s)
Compiling generated Java code. Error
B4A line: 35
End Sub
src\gb4x\gsfid\b4xmainpage.java:121: error: cannot find symbol
public String getGsfAndroidId(Context context)
^
symbol: class Context
location: class b4xmainpage
1 error
I also put this <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> at manifest
Any ideas please?