Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create an (repetitive high pitch) Alarm on a remote trigger when App is not running (iphone/android) just like Find My iPhone

I would like to cause an alarm on a remote iphone/android device when the app is running or not running.

How do I achieve it ?

I can only think of Whatsapp/Skype when there is incoming call, its ringing. Or would it be possible to cause the phone to play a looping alarm sound on Push Notification.

Another very clear example is "Find My iPhone" app which can trigger a loud alarm to an iPhone.

How can I achieve this programmatically on ios and android ?

like image 945
Axil Avatar asked Jul 23 '17 16:07

Axil


People also ask

Does iPhone alarm go off when phone is on silent?

Good news: the answer is yes. Regardless of whether you've turned off your iPhone's ringer or turned your iPhone on silent and chose to only have it vibrate, any alarms you set will still sound aloud.

Is there an alarm on iPhone?

In the Clock app , you can set alarms for any time of day and have them repeat on one or more days of the week. Siri: Say something like: “Set an alarm for 7 a.m.” Learn how to use Siri.

Is iPhone alarm based on ringer or volume?

Check your alarm volume before you go to sleep. The alarm will start playing at the current ringer volume , which is how loud your alarm will be, assuming you don't change the level later. To make it louder or quieter, just use the buttons to adjust the volume while the test alarm is playing.


2 Answers

Its possible using FireBase Notification Services with JobService & FirebaseMessagingService.

  • Download the FireBase samples from here .Run module "messaging".I tested it and I was able to receive the notification , even in the Application killed state.

  • To manage events periodically/scheduled you must implement & deploy your Server somewhere.You can also check FireBase Functions (Beta) to easily implement Server.

  • To show something (Alaram/UI like calling screen) to user start your custom Activity while receiving FireBase notification.Override handleIntent from FirebaseMessagingService.So that you can receive data from your killed/idle Application.

  • FireBase Service is System Service & it will be always running.Please have a read.

    Code snippet

    @Override
    public void handleIntent(Intent intent) {
        super.handleIntent(intent);
        // Get Data here
        Log.d(TAG, "intent.."+intent.getExtras());
        Intent intent1=new Intent(this,MainActivity.class);
        intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent1);
    }
    

Note : Some devices (Eg; ASUS's Mobile Manager) may reject to start Application's receiver while , Notification arrives.In that case please provide appropriate permissions.

like image 171
Don Chakkappan Avatar answered Oct 24 '22 06:10

Don Chakkappan


1 possible solution could be schedule alarm event with repeatInterval on receiving push notification.

EDIT We can create custom notifications using Notification extensions.They are called as soon as notification arrives & we can present customized view with image/video downloading. So you can try there to schedule events.

like image 23
Ellen Avatar answered Oct 24 '22 04:10

Ellen