function Getlauncherclassname:jstring;var str:jstring; Localpackagemanager:jpackagemanager; Intent:jintent; Localiterator:jiterator; Localresolveinfo:jresolveinfo;begin Localpackagemanager: = Sharedactivity.getpackagemanager; Intent: = TJIntent.JavaClass.init (stringtojstring (' Android.intent.action.MAIN ')); Intent.addcategory (stringtojstring (' Android.intent.category.LAUNCHER ')); Try Localiterator: = Localpackagemanager.queryintentactivities (intent,0). iterator; While Localiterator.hasnext does begin localresolveinfo: = Tjresolveinfo.wrap ((localiterator.next as Ilocalobject). G Etobjectid); if (not LocalResolveInfo.activityInfo.applicationInfo.packageName.equalsIgnoreCase (sharedactivity.getpackagename ) then Continue; Result: = LocalResolveInfo.activityInfo.name; break; End Except End;end;procedure Sethuaweibadge (Num:integer); var str:jstring; Localbundle:jbundle;begin str: = Getlauncherclassname; If Jstringtostring (str) <> "THEN begin localbundle: = TJBundle.JavaClass.init; Localbundle.putstring (stringtojstring (' package '), Sharedactivitycontext.getpackagename ()); Localbundle.putstring (stringtojstring (' class '), str); Localbundle.putint (stringtojstring (' Badgenumber '), 3); SharedActivityContext.getContentResolver.call (Strtojuri (' content://com.huawei.android.launcher.settings/badge/ '), stringtojstring (' Change_badge '), stringtojstring (' null '), localbundle); End;end;
Now there is only Huawei's mobile phone, the other non-tested code is not posted out, to find their own Java code conversion.
Judging phone type: TJBuild.JavaClass.MANUFACTURER.EqualsIgnoreCase (stringtojstring (' Huawei '))
Delphi displays numbers on the phone's desktop icon