Sub Process_Globals
Dim sNotif As Notification
End Sub
Sub Service_Create
sNotif.Initialize
sNotif.Icon = "icon"
'the last parameter in the next line is the module to be started when the user presses on Notification
sNotif.SetInfo("My Service Info", "This is a message to the user ....","")
sNotif.Sound = False
sNotif.Notify(1)
Service.StartForeground(1,sNotif)
End Sub
Sonny , from what I gather you just don't include a module name in the Notification.SetInfo method .. ie
B4X:Sub Process_Globals Dim sNotif As Notification End Sub Sub Service_Create sNotif.Initialize sNotif.Icon = "icon" 'the last parameter in the next line is the module to be started when the user presses on Notification sNotif.SetInfo("My Service Info", "This is a message to the user ....","") sNotif.Sound = False sNotif.Notify(1) Service.StartForeground(1,sNotif) End Sub
I want to use the notification area JUST for the purpose of displaying messages to the user. I DO NOT want to launch any activities when the user taps on the notification.
sNotif.SetInfo("HangUp & POQ", "Monitoring for Telemaketing Calls ....",Main)
Sonny .. Yes I read your post.
The code I posted is from a current service that runs to monitor phone calls.
when I press on my notification it restarts the Main activity .. which has be closed down.B4X:sNotif.SetInfo("HangUp & POQ", "Monitoring for Telemaketing Calls ....",Main)
by replacing the last parameter 'Main' with an empty string it does NOT launch my 'Main' activity ...
I'm not a services guru .. maybe i'm missing something
An intent is required on Android 2.3-. If you are not targeting these devices then it is possible to create a notification without an activity using reflection library (I can show you the required code).
http://stackoverflow.com/questions/...intent-required-in-notificationcompat-builder
You cannot use the same notification on Android 2.3.x if you remove the activity. A simple solution that will work with all devices is to create a "dummy" activity and call Activity.Finish from Activity_Create.also providing me with an effective way of dealing with 2.3.5, etc. would be greatly appreciated.
It shouldn't. Are you making the calculations in Activity_Create or Activity_Resume?If I call a "dummy activity", then returning to my "real activity" will cause it to re-run all of the calculations and repaint the resulting graphics again.
It shouldn't. Are you making the calculations in Activity_Create or Activity_Resume?
Dim r As Reflector
r.Target = NotificationObject
r.RunMethod4("setLatestEventInfo", Array As Object(r.GetContext, "title", "body", Null), _
Array As String("android.content.Context", "java.lang.CharSequence", "java.lang.CharSequence", _
"android.app.PendingIntent"))
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?