Search the Community
Showing results for tags 'notification'.
Found 2 results
-
Delphi Android service was stopped after closing the android application
Sathiya89 posted a topic in Cross-platform
I have used Delphi 12 for developing Android application and I'm trying to Service which needs to runs in the background to receive the frequent messages from Server using TCP sockets to displays the notifications. But, the service is deactivated / closed after the main process application is closed. Below, the code is mentioned the code to start the service : procedure TForm1.ButtonServiceStartClick(Sender: TObject); var ServiceIntent: JIntent; begin ServiceIntent := TJIntent.Create; ServiceIntent.setClassName(TAndroidHelper.Context, StringToJString('com.embarcadero.services.MyService')); TAndroidHelper.Context.startService(ServiceIntent); end; and also, I have added the following service information in AndroidManifest.template.xml : <service android:enabled="true" android:exported="false" android:label="MyService" android:process=":remote" android:name="com.embarcadero.services.MyService"> </service> Code in Service: function TDM.AndroidServiceStartCommand(const Sender: TObject; const Intent: JIntent; Flags, StartId: Integer): Integer; begin Result := TJService.JavaClass.START_STICKY; end; I have tried to use this Solution, but not able to compile. And tried to implement the Sleep in Android Start command / run the thread, still the android service is getting closed. Do, I need to mentioned the different flag for starting the service or do I need to add additional code to run the service all the time or can we restart the service once it's destroyed and how to handle the code in Destroy event? -
Using iOS LocalNotification with EKAlarm, EKEvent, EKEventStore as "short time, timer alarm"
Rollo62 posted a topic in Cross-platform
Hi there, I'm looking for ways to create a simple short-time timer under iOS. via LocalNotifications: One possibility is to use LocalNotifications, but its not much customizeable, nor to make it prominent. Also it seems not to be too reliable via PushKit: that looks more interesting, but I'm afraid that all notifications (even the 15 sec. timer) has to be launched via Apples APNs server. via Calendar system: The Apple doc say that this is not the right way anyway, but to use the EventKit Calendar and EKEventStore. https://developer.apple.com/documentation/eventkit To access the EKEventKit would mean that the app needs calendar permissions Which is quite heavy requirements for a simple timer notification, of <= 2h. But at least with that I could possibly change the alarm sound. The alarm would then be handled from the central calendar app of the phone, I think that this also will open my app via LocalNotification, under the right condition, when user presses the open button. Moreover, I'm not sure if this adds an visible event in the calendar, what I don't want. But I think there should be ways to hide/delete an invisible event, but Apple docs, see note below, restricts that. There are some old calendar examples already in the D.P.F. component suite, the first 3rd party componentes of FMX, as far as I know. I think they are a little outdated by permissions now, but maybe basically still OK. The URL is deprecated, it shall use EMailAddress instead. Which also sets Sound to nil, and doesn't seem to be able to open an related app. Via EventKit this is maybe still possible, maybe with the EventStoreChanged, with a lot of overhead (see note below). Is there any lighter middle way: Two notes from Apple docs: My question is if there is maybe a middle way, or an extension to the LocalNotification, to allow a simple alarm timer running without too much permission requests or overhead ?- 4 replies
-
- ios
- notification
-
(and 1 more)
Tagged with: