Im developing a chat app which uses GCM to notify the user of incoming messages. One problem I can't seem to fix is that every manufacturer seems to implement his own battery saving in addition to the doze feature of Android. Most of the time a few apps get automatically put on the whitelist of these phones(like whatsapp).
As example Huawei uses "Protected Apps" and only if the user accepts my Intent which tries to add my App to the protected apps, only then my app works as expected.
Is there any way to get whitelisted or something like that for every manufacturer ? I can't believe I have to buy every phone on the market to test if somebody decided the doze feature is not enough.
Best Regards!
Related
I have created a mini App that helps me playing with beacons.
-what i have done so far-
So until now, I have successfully connected my App to the beacon, made 2 texts, so when I'm in the app and get in the beacon's range, the texts are changing so I can see that, move 2m away or turning the beacon upside down so it simulates Out of range, and it will show the message that I'm not in the range anymore.
So far so good, I have also successfully made the app to show notifications when I get close to the beacon, and when I click the notification to open a second activity.
-the problem-
Now, I want to show a notification when I get in the beacon's range, and the app is closed (not in the background). And after, when I click on that Notification to open my app / open App Google Play's Page if not installed.
I have searched on the internet but I haven't found anything conclusive.
If you guys know anything, or have you accomplished this task, it would be great if you can help with it.
If you need more info like, my activities code I can upload it, but I considered unimportant.
Thanks!
Two points:
In order to make a phone react to a beacon without your app installed (e.g. to launch a PlayStore page) you need an app prei-nstalled on all phones that does this for you. The Google Play Services app used to do this through the Nearby feature, but it was discontinued in Nov. 2018 because of spam concerns. Since then this is no longer possible to do.
If you do have your app installed it is a straightforward process to detect in the background and send notifications. The Android Beacon Library provides instructions here:. https://altbeacon.github.io/android-beacon-library/notifications.html
You could create a BoradcastReceiver that intercept the android.intent.action.BOOT_COMPLETED.
In that way, you can launch a part of your app when you turn on the device.
There, you can use a Service or something that can manage the interactions with Beacons.
(BTW, i never worked with Beacons, i don't know what are the policies that you must follow).
If you don't need to launch the app when the device is turned on, anyway you can use a simple Service
Here the link to the documentation of receivers documentation.
I've developed an app which receives push notifications from Parse. The app is designed to run in background so that notifications can be received even when app is closed.
But we are facing challenge with Huawei's devices due to its custom "power savings" feature which detects the app as power intensive and hence clears it from memory when screen is locked.
Are there any known methods to prevent the app from being restricted or to add it to "Protected Apps" list upon installation?
Note: We begun with GCM notificatoins, but after learning that GCM's notification deliverability is flaky, we moved on to Parse.com's PPNS and then this new roadblock.
We cant do much except detect the device,if device is huawei warn the user about propably issue if the desired app wont be added to protected apps hence this is the only way to do what we need.No other ways available and i reckon it will never be!
In Android, I want to know if I can receive the event whenever I open Android Message Application?
I tried get task in foreground but that didn't work in service as for that service has to continuously poll
Kindly guide
The only way you can achieve this is by polling. No other way :(
I can receive the event whenever I open Android Message Application?
No.
First, there are thousands of Android device models, spanning hundreds of manufacturers. There are dozens upon dozens of "Android Message Application" pre-installed across the device models, as manufacturers often provide their own. There are also hundreds of "Android Message Applications" available on the Play Store and elsewhere. You have no great way to know what apps are and are not "Android Messaging Applications", though you could try to examine <intent-filter> structures and deduce which ones might meet your requirements.
Second, there are no events posted to ordinary Android SDK apps when other apps or their activities start. Even some of the polling techniques that you mention will not work on Android 5.0+, and any that still do work represent bugs that should get fixed. Google is locking down this information for privacy and security reasons, such as to help prevent OAuth hijacking attacks like this one.
I've seen some "app locking" solutions in the Google Play store and I was wondering how those apps work. I'd like to build something similar.
I realize that this might require some special permission or maybe request the app to be added as device administrator.
Is there some broadcast that is triggered just before an app is launched that I can intercept and do some action (e.g. launch an activity that will request the user to fill a password)? I've read some lengthy discussions how this is not a good idea and the only idea is to have a background service that will continuously poll the running processes and check for changes, but I think retrieving this list every second and checking it for chances is not good for the battery and I think other app locking apps out there must be using a different approch.
If possible, without the need for a rooted phone.
I have created an app. Works great, but I want some same functionality as gmail uses:
When I receive a new email, I get a notification. I inspected my phone and saw no services or applications running that look like the gmail-app.
I have investigated the AlarmManager and services, but as soon as I stop the app both don't work anymore.
Could someone give me a hint how to accomplish this?
Thanks in advance
I inspected my phone and saw no services or applications running that look like the gmail-app.
Partly, that is because Gmail gets such notifications via broadcast Intents from the OS, via the subsystem we see as C2DM (which is why you do not see a process). Partly, that is because Gmail is part of the firmware and may get some extra benefits as a result, in terms of resisting the normal behaviors that befall an app that is force-stopped.
Could someone give me a hint how to accomplish this?
You can't. Particularly on Android 3.1+, if your app is force-stopped, it will not run again until the user manually runs one of your activities (e.g., from the launcher).