Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Clock Alarm & background running

Discussion in 'Scripting' started by jarduz, Nov 5, 2018.

  1. jarduz

    jarduz

    Joined:
    Feb 12, 2015
    Posts:
    7
    Hi everyone,

    I am making a clock alarm app for android platform. My question is how to open my app even when the phone is lock down (with screen off) at a specific time pre-programmed by the user.

    As you know for example when a call comes in, the screen turns on and the "phone" application is displayed. This is the same effect I want to create. So maybe I have two questions:

    1.- Should I run my app at background?, so even when it is closed, it will bring me up the alarm. So how to do it?
    2.- When the time arrives, how should I turn on screen to display my app.

    Thanks in advanced.
     
  2. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Don't use unity for such a simple thing..

    an alarm clock doesn't need a physics engine and AI build in to it.

    it's gonna drain the battery super fast compared to other "regular" apps

    learn how to make a custom app, it's not hard at all, an alarm clock is pretty trivial
     
    Antypodish, Lurking-Ninja and Reeii like this.
  3. Reeii

    Reeii

    Joined:
    Feb 5, 2016
    Posts:
    91
    Exactly as SparrowsNest said:
    Use e.g. AndroidStudio together with Java (the differences between Java and C# and really small) and research "scheduled jobs in android" as that's probably the best way to achieve what you want to.
     
  4. jarduz

    jarduz

    Joined:
    Feb 12, 2015
    Posts:
    7
    Yeah well actually my app is a little bigger than that. Open my application in a programmed way is just a future.
     
  5. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    If you want to use C# i think you can use xamarin form(or something like that) works with c# and a bit of xaml i think
     
  6. Create a background service and send notification to the user when the time comes. But do not open your application directly, and probably you can't regardless. (I'm not sure, I'm not a mobile developer per say)
    To create background service you will need native tools.
     
  7. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,822
    And perhaps no one wants additional background processes. Specially on mobile.
     
    SparrowGS likes this.