Android Question Create a reminder

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi all.
I need to create reminder that will remind to the user to clock out from his shift (my app does clock in / clock out check).
I check the forum and I found the libraries GoogleCalender and calendar2 ver. 1.13

So my question is - is it possible to create a reminder if the user doesn't have a Google account at all?

Thanks and Happy New Year.
 

JohnC

Expert
Licensed User
Longtime User
I think there would still be a calendar database in the device even without a google account.

To test this, just run the calendar app and create a new scheduled item (that should create a database if there was not one already). Then use a calendar lib to enumerate the available databases and then your app could access it.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
Does the reminder have to come from a calendar app? If not you can use a service and call StartServiceAt to issue a notification at the required time. Then you don't have to make any assumptions about which apps the user has on their 'phone.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Does the reminder have to come from a calendar app? If not you can use a service and call StartServiceAt to issue a notification at the required time. Then you don't have to make any assumptions about which apps the user has on their 'phone.
Thanks for your advice. But what if the app is closed by by the user? Let's say he didn't clock out and closed the app.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
The StartServiceAt will persist if the app is closed., but not if the user turns the 'phone off, You can use StartAtBoot to even get round that.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
The StartServiceAt will persist if the app is closed., but not if the user turns the 'phone off, You can use StartAtBoot to even get round that.
To close the app I'm using this
B4X:
public Sub ExitApp ' intentional exit
    
    Try
        Dim jo As JavaObject
        jo.InitializeContext
        jo.RunMethod("finishAffinity", Null)
        ExitApplication
    Catch
        Log("ExitApp " & LastException.Message)
        ShowError("modFun_ExitApp " & LastException.Message)
    End Try
    
    
End Sub
 
Upvote 0
Top