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

3 Solutions Collect From Internet About “Create an (repetitive high pitch) Alarm on a remote trigger when App is not running (iphone/android) just like Find My iPhone”

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.

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.

For iOS, you will need a server to deliver a push notification to your app, where the notification references a custom audio alert to be played. The audio alert has to be included within the app’s bundle as stated in Apple docs.

This alert can’t be longer than 30 seconds. If you want the alert to be played longer, you can send send another push notification times roughly 30-seconds after and stop sending the alert when a) user open the app or b) you’ve reached the maximum threshold.

It’s generally not good practise to send multiple notification containing the same payload, unless there is a good reason.

I would suggest splitting up this question into two: one for iOS, and another for Android.