A anaylor01 Well-Known Member Licensed User Longtime User Mar 7, 2014 #1 When my app is open it works fine. But when I use Exitapplication it doesn't seem to work. Now under running applications it shows my app with 1 process and 1 service running. This is for an alarm clock. The only code I have in my service is this Sub Service_Start (StartingIntent As Intent) CallSubDelayed(Main, "run_tm") End Sub Any ideas???
When my app is open it works fine. But when I use Exitapplication it doesn't seem to work. Now under running applications it shows my app with 1 process and 1 service running. This is for an alarm clock. The only code I have in my service is this Sub Service_Start (StartingIntent As Intent) CallSubDelayed(Main, "run_tm") End Sub Any ideas???
Erel B4X founder Staff member Licensed User Longtime User Mar 7, 2014 #2 You should not call ExitApplication. Call Activity.Finish and let the OS decide when to kill the process. Upvote 0
You should not call ExitApplication. Call Activity.Finish and let the OS decide when to kill the process.
A anaylor01 Well-Known Member Licensed User Longtime User Mar 7, 2014 #3 I tried your way and it closed the process and the service. Upvote 0
M Mrjoey Active Member Licensed User Longtime User Mar 7, 2014 #4 u should call Code: Copy Service.StartForeground(1,n) n is a notification Upvote 0
A anaylor01 Well-Known Member Licensed User Longtime User Mar 7, 2014 #5 What am I doing wrong? Timer is the name of the service. Timer.StartForeground(1,"tet") Upvote 0
mangojack Expert Licensed User Longtime User Mar 8, 2014 #6 What is "tet" ? In the timer service process globals .. Code: Copy Dim Notif As Notification then Code: Copy Sub Service_Create Notif.Initialize Notif.Icon = "icon" Notif.SetInfo("Alarm Clock","my alarm is running ...",Main) Notif.Sound = False Notif.Notify(1) Service.StartForeground(1,Notif) 'do NOT change to "Timer" End Sub[code] Upvote 0
What is "tet" ? In the timer service process globals .. Code: Copy Dim Notif As Notification then Code: Copy Sub Service_Create Notif.Initialize Notif.Icon = "icon" Notif.SetInfo("Alarm Clock","my alarm is running ...",Main) Notif.Sound = False Notif.Notify(1) Service.StartForeground(1,Notif) 'do NOT change to "Timer" End Sub[code]
A anaylor01 Well-Known Member Licensed User Longtime User Mar 8, 2014 #7 "txt" was just a text value. Was supposed to be "test". This service needs to run without notification. It will be running at all times. Upvote 0
"txt" was just a text value. Was supposed to be "test". This service needs to run without notification. It will be running at all times.
A anaylor01 Well-Known Member Licensed User Longtime User Mar 8, 2014 #8 Here is what needs to happen. The user sets the alarm. The app closes. When the specified time is reached the app opens back up. Upvote 0
Here is what needs to happen. The user sets the alarm. The app closes. When the specified time is reached the app opens back up.
mangojack Expert Licensed User Longtime User Mar 8, 2014 #9 I might be wrong .. but if a service is to continually run (not be killed by OS) by using Service.StartForeground it Must display Notification to user. No. This is how Android is designed. If you want your service to be treated as a foreground service then an icon must be shown. You may play with the icon and put a transparent icon. Erel Click to expand... Maybe read this Suppress notification for Service.StartForeground .... Last edited: Mar 8, 2014 Upvote 0
I might be wrong .. but if a service is to continually run (not be killed by OS) by using Service.StartForeground it Must display Notification to user. No. This is how Android is designed. If you want your service to be treated as a foreground service then an icon must be shown. You may play with the icon and put a transparent icon. Erel Click to expand... Maybe read this Suppress notification for Service.StartForeground ....
A anaylor01 Well-Known Member Licensed User Longtime User Mar 8, 2014 #10 So the alarm clock that comes with android doesn't need a notification because it is part of the OS? Upvote 0
mangojack Expert Licensed User Longtime User Mar 8, 2014 #11 unsure .. my alarm clock displays notification. maybe look at transparent Icon with no text ... maybe wait for a guru to reply Upvote 0
unsure .. my alarm clock displays notification. maybe look at transparent Icon with no text ... maybe wait for a guru to reply
A anaylor01 Well-Known Member Licensed User Longtime User Mar 8, 2014 #12 Ok check this out. Pandora has an alarm you can use to wake up to Pandora. It uses the same Icon as Android Clock Icon. So now I have to figure out how to use the system Icon. Upvote 0
Ok check this out. Pandora has an alarm you can use to wake up to Pandora. It uses the same Icon as Android Clock Icon. So now I have to figure out how to use the system Icon.
A anaylor01 Well-Known Member Licensed User Longtime User Mar 19, 2014 #13 Does anyone know about this? Upvote 0
lemonisdead Well-Known Member Licensed User Longtime User Mar 19, 2014 #14 Yes they use the same image for their notification ? It should be available from the Android SDK Upvote 0
A anaylor01 Well-Known Member Licensed User Longtime User Mar 19, 2014 #15 Well that is my question how do I make it use the same one in my app so it would appear as the default alarm. Upvote 0
Well that is my question how do I make it use the same one in my app so it would appear as the default alarm.
lemonisdead Well-Known Member Licensed User Longtime User Mar 21, 2014 #16 If you are asking the way to find the icon, you should find it on your HD in your Android's folder. For example : C:\Android\platforms\android-19\data\res\drawable-xhdpi\ic_audio_alarm.png Just import this image using B4A's "Files" tab and "Add files". Then use the reference to the file. For example : LoadBitmap(File.DirAssets, "ic_audio_alarm.png") Upvote 0
If you are asking the way to find the icon, you should find it on your HD in your Android's folder. For example : C:\Android\platforms\android-19\data\res\drawable-xhdpi\ic_audio_alarm.png Just import this image using B4A's "Files" tab and "Add files". Then use the reference to the file. For example : LoadBitmap(File.DirAssets, "ic_audio_alarm.png")
A anaylor01 Well-Known Member Licensed User Longtime User Mar 24, 2014 #17 Well what I am trying to do is not to create another alarm icon. I want to use it just like Pandora and other apps do. So if set the Pandora alarm the same icon and location shows up as if you set the system alarm. Upvote 0
Well what I am trying to do is not to create another alarm icon. I want to use it just like Pandora and other apps do. So if set the Pandora alarm the same icon and location shows up as if you set the system alarm.