Snip2Code is shutting down.
It has been quite a ride, since 2013 when we launched our first prototype: thanks to the effort of you guys we collected more than 3 million snippets!
We are very proud to help all our users to be more efficient in their jobs, and to be the central point to share programming knowledge for everyone.
Our basic service is free, so we always survived on our own resources to give you Snip2Code.
Unfortunately, we are no more in the financial position to sustain this effort, and therefore we are announcing here our permanent shut down,
which will take place on August 1st, 2020.
Please save your private snippets using our backup function in the settings, here.
IF YOU WANT TO SAVE SNIP2CODE, PLEASE CONSIDER DOING A DONATION!
This will allow us to pay for the servers and the infrastructure. If you want to donate, Contact Us!
by
126 13
4
8
7,903
10
Top 1% !
Famous
Pearl of Wisdom
Tagged
Easy-to-find
Specified
Debate
OpenSource
Popularity: 812nd place
Languagepascal
LicenseMIT_X11
OSAndroid

Install A Shortcut On Android With Delphi XE5 Firemonkey

http://www.fmxexpress.com/install-shortcuts-on-the-android-home-screen-with-delphi-xe5-firemonkey/
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/34147/Install-A-Shortcut-On-Android-With-Delph?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
//Android permission required: //<uses-permission android:name=”com.android.launcher.permission.INSTALL_SHORTCUT”/> Uses Androidapi.JNI.GraphicsContentViewText, FMX.Helpers.Android, Androidapi.JNI.JavaTypes, FMX.Platform.Android, AndroidApi.JniBridge, AndroidApi.Jni.App, AndroidAPI.jni.OS; {$IFDEF ANDROID} var ShortcutIntent: JIntent; addIntent: JIntent; wIconIdentifier : integer; wIconResource : JIntent_ShortcutIconResource; {$ENDIF} begin {$IFDEF ANDROID} ShortcutIntent := TJIntent.JavaClass.init(SharedActivityContext, SharedActivityContext.getClass); ShortcutIntent.setAction(TJIntent.JavaClass.ACTION_MAIN); addIntent := TJIntent.Create; addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_INTENT, TJParcelable.Wrap((shortcutIntent as ILocalObject).GetObjectID));// here we need to cast the intent as it’s not done in delphi by default, not like java addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_NAME, StringToJString(Application.Title)); addIntent.setAction(StringToJString(‘com.android.launcher.action.INSTALL_SHORTCUT’)); // get icon resource identifier wIconIdentifier := SharedActivity.getResources.getIdentifier(StringToJString(‘ic_launcher’), StringToJString(‘drawable’), StringToJString(‘com.embarcadero.HeaderFooterApplication’)); // if the app name change, you must change the package name wIconResource := TJIntent_ShortcutIconResource.JavaClass.fromContext(SharedActivityContext, wIconIdentifier); // set icon for shortcut addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_ICON_RESOURCE, TJParcelable.Wrap((wIconResource as ILocalObject).GetObjectID)); SharedActivityContext.sendBroadcast(addIntent); {$ENDIF}
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus