Reflector name of a service

Prosg

Active Member
Licensed User
Longtime User
hello,

i try to have the name of a service with reflector...

B4X:
Dim r As Reflector
   Dim sServiceName As String
    r.Target = r.RunStaticMethod("android.app.getWallpaperInfo", "getInstance", Array As Object(r.GetContext), Array As String("android.content.Context"))
    sServiceName = r.RunMethod("getServiceName")
   Msgbox(sServiceName,"")

it's return a error

the android source :
WallpaperInfo | Android Developers

here the solution in java

B4X:
WallpaperManager wpm = (WallpaperManager) getSystemService(WALLPAPER_SERVICE);
WallpaperInfo info = wpm.getWallpaperInfo();
if (info != null && info.getComponent().equals(new ComponentName(this, getClass()))) {
    Log.d(TAG, "We're already running");
    // Still might be a preview, but the user is already running your LWP.
} else {
    Log.d(TAG, "We're not running, this should be a preview");
    // Should definitely be a preview.
}

Thx for help
 
Last edited:

Prosg

Active Member
Licensed User
Longtime User
i always try to know the name of current service

B4X:
 Dim r,t As Reflector
r.Target = r.RunStaticMethod  ("android.app.WallpaperManager", "getInstance", Array As Object(r.GetContext), Array As String("android.content.Context"))


How to change this java :
WallpaperInfo info = wpm.getWallpaperInfo();

in basic4android ?
r.RunMethod("getWallpaperInfo")

i hate weekend cause Erel doesn't save my code :p

Must be very occupied with the new version 2.5 :)

Need a java converter to Basic4android program :p or need to clone Erel... is there a great genitician here :)
 
Last edited:
Upvote 0
Top