Results :
1. Because only Xiaomi mobile phone, no Samsung mobile phone, unable to test. If any God has tested it, remember M i oh, thanks.
Instance code:
1 UnitUnit1;2 3 Interface4 5 uses6 system.sysutils, System.types, System.uitypes, system.classes, System.variants,7 FMX. Types, FMX. Controls, FMX. Forms, FMX. Graphics, FMX. Dialogs, Fmx.stdctrls,8 FMX. controls.presentation;9 Ten type OneTForm1 =class(Tform) A Label1:tlabel; - Button1:tbutton; - procedureButton1Click (sender:tobject); the Private - {Private Declarations} - Public - {Public Declarations} + End; - + var A Form1:tform1; at - Implementation - uses - //Androidapi.JNI.JavaTypes, the great god of the Internet said to introduce, but I didn't see where to use - //FMX. Platform.android, - //AndroidApi.Jni.App, inAndroidAPI.jni.OS,//need to introduce -Androidapi.JNI.GraphicsContentViewText,//need to introduce toAndroidapi.jnibridge,//need to introduce +Androidapi.helpers;//need to introduce - {$R *.FMX} the {$R *. NMXHDPIPH.FMX ANDROID} * $ procedureTform1.button1click (sender:tobject);Panax Notoginseng {$IFDEF ANDROID} - var the shortcutintent:jintent; + addintent:jintent; A Wiconidentifier:integer; the Wiconresource:jintent_shortcuticonresource; + {$ENDIF} - begin $ {$IFDEF ANDROID} $Shortcutintent: =TJIntent.JavaClass.init (Sharedactivitycontext, sharedactivitycontext.getclass); - shortcutintent.setaction (TJIntent.JavaClass.ACTION_MAIN); - theAddintent: = tjintent.Create; -Addintent.putextra (TJIntent.JavaClass.EXTRA_SHORTCUT_INTENT, Tjparcelable.wrap (shortcutintent asilocalobject). Getobjectid));Wuyi Addintent.putextra (TJIntent.JavaClass.EXTRA_SHORTCUT_NAME, stringtojstring (Application.title)); theAddintent.setaction (Stringtojstring ('Com.android.launcher.action.INSTALL_SHORTCUT')); - Wu //Get icon Resource Identifier//Please change the underlined red section to your project name, others do not need to be modified. -Wiconidentifier: = SharedActivity.getResources.getIdentifier (Stringtojstring ('Ic_launcher'), Stringtojstring ('drawable'), Stringtojstring ('Com.embarcadero. Project1 ')); AboutWiconresource: =TJIntent_ShortcutIconResource.JavaClass.fromContext (Sharedactivitycontext, wiconidentifier); $ //set icon for shortcut -Addintent.putextra (TJIntent.JavaClass.EXTRA_SHORTCUT_ICON_RESOURCE, Tjparcelable.wrap (wiconresource asilocalobject). Getobjectid)); - - Sharedactivitycontext.sendbroadcast (addintent); A {$ENDIF} + End; the - End.
Android Instance-Create a shortcut for the program (not tested)