deku-messaging / DekuSMS-Android

Android SMS app ~ Featuring E2EE, Cloud Forwarding, RMQ integrations
GNU General Public License v3.0
370 stars 19 forks source link

What tasks require your app to use the FOREGROUND_SERVICE_DATA_SYNC permission? #252

Closed akashappscale closed 5 months ago

akashappscale commented 5 months ago

What tasks require your app to use the FOREGROUND_SERVICE_DATA_SYNC permission? Network processing Backing up, restoring Other Local processing Media transcoding Importing, exporting Other > Other tasks Other

sherlockwisdom commented 5 months ago

If you go to Settings -> Developers, you can set up a RabbitMQ listener to talk to your RabbitMQ cloud instance. Allows you use your phone as a Gateway server, but also has to keep a Foreground running service to do that that's why the permission.

https://github.com/deku-messaging/Deku-SMS-Android?tab=readme-ov-file#-android-phone-as-sms-gateway

akashappscale commented 5 months ago

What tasks require your app to use the FOREGROUND_SERVICE_DATA_SYNC permission?

public void createForegroundNotification(int runningGatewayClientCount, int reconnecting) { Log.e("AAAA", "createForegroundNotification: " ); Intent notificationIntent = new Intent(getApplicationContext(), GatewayClientListingActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE);

    String description = runningGatewayClientCount + " " +
            getString(R.string.gateway_client_running_description);

    if(reconnecting > 0)
        description += "\n" + reconnecting + " " +
                getString(R.string.gateway_client_reconnecting_description);

    Notification notification =
            new NotificationCompat.Builder(getApplicationContext(),
                    getString(R.string.running_gateway_clients_channel_id))
                    .setContentTitle(getApplicationContext()
                            .getString(R.string.gateway_client_running_title))
                    .setSmallIcon(R.drawable.ic_stat_name)
                    .setPriority(NotificationCompat.DEFAULT_ALL)
                    .setSilent(true)
                    .setOngoing(true)
                    .setContentText(description)
                    .setContentIntent(pendingIntent)
                    .build();

    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
        startForeground(NOTIFICATION_ID, notification,
                ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
    }
    else
        startForeground(NOTIFICATION_ID, notification);
}

What is the function of the createForeground Notification function?
sherlockwisdom commented 5 months ago

I have described the task requiring that permission above, if you go through the code (if you are on Android studio) you can trace down the processes calling that method see which services require the creation of a notification service.

akashappscale commented 5 months ago

[image: Capture.PNG] Which of these options is to be selected?

On Tue, 25 Jun 2024 at 18:06, Wisdom Nji @.***> wrote:

I have described the task requiring that permission above, if you go through the code (if you are on Android studio) you can trace down the processes calling that method see which services require the creation of a notification service.

— Reply to this email directly, view it on GitHub https://github.com/deku-messaging/Deku-SMS-Android/issues/252#issuecomment-2188819302, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEQO6ABOK7JDPBUHXSWE463ZJFP4DAVCNFSM6AAAAABJ3XE2CCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBYHAYTSMZQGI . You are receiving this because you authored the thread.Message ID: @.***>