Trying to send GCM notification to the devices asus,xiaomi redmi 1s but not getting the notification while the same notification is getting delivered to the other devices.As given in link
GCM notification not received on one of the mobile devices
these devices having security app such as AutoStart to disable app run in background on install.
So the question is how to notify user to enable app in autostart? Is there any programmatic way to deal with it because in our case if no GCM then there is no use of our app.
If you want any code then I can give it but as I stated above its(GCM) working on other devices and also work on above devices if app is enabled in Autostart,so I think there is no need to add code.
Thanks.
I have been dealing with the same issue from a long time. These devices specially redmi devices create a lot of problem . Redmi doesn't provide enough freedom to deal with notifications programatically. With every new install, you'll have to manually turn on autostart from 'Security' otherwise push notifications might have erratic behaviour. Further you'll have to add
GET_TASKS permission
in these devices which is deprecated
Related
I have a GPS tracking Android app that receives continuous push messages when someone requires user's position.
Everytime that I receive a push, I start the location service that send positions during X time while he is receiving push messages.
The problem started with android Doze system, that block http requests. I could receive messages but I never could send my current position (I received timeouts of http connections and error in pings to Google). But i could solve it with ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS request and adding the app into battery whitelist programatically.
Now, the app works fine in all devices except on Samsung devices over S6, that have "Smart manager" system. I tried to add manually the app into Samsung's battery whitelist (Setttings -> Device Maintenance -> Battery -> Unmonitored apps) but the problem persist.
If I keep the device with screen off and no charging, in a few time, it stops sending positions, but he still recieving push messages.
Can anyone help me with a magical solution? I saw a alleged "packages list" with a lot of apps that Samsung includes automatically into whitelist (Facebook, Whatsapp, Life360, for example) but I couldn't find what I need to do to add my app into this list automatically.
Based on the link provided by #ManmeetP, it looks like your only option is to use Samsung's "Knox" SDK: ApplicationPolicy.addPackageToBatteryOptimizationWhiteList()
https://seap.samsung.com/api-references/android-standard/reference/android/app/enterprise/ApplicationPolicy.html
This would mean bundling that SDK into your app for all your users =(
I have integrated gcm notifications.
everything is working fine.
server is giving success but notifications are not coming on marshmallow.
i have tested in other versions also. they are receiving fine.
Have a look at
http://android-developers.blogspot.ae/2015/10/how-google-cloud-messaging-handles-doze.html
Android 6.0 Marshmallow introduces a new power saving feature called ‘Doze’ which may be affecting your notifications.
when using normal priority (the default priority), there are a number
of different behaviors when the device is in Doze, including:
The most important change is that messages will be batched for devices in Doze. When the device enters its idle maintenance window,
the batch of messages will be received.
We discard messages whose time_to_live expires while the device is in Doze (including TTL=0).
There is no known problem in receiving GCM messages on Marshmallow.
So I suggest first testing with one of the many GCM tester apps on the Google Play: https://play.google.com/store/apps/details?id=com.eboyer.gcmtester
This would allow you to debug wether it's an issue in your app or the system.
I developed an Android app for push notification. The targeted SDK is 23 and the minimum SDK is 11. I tested the app in Huawei P6 (4.2.2) and it runs smoothly, but I tested it with Huawei Y360 (4.4.2) and app does not work - push notification is neither sent or received.
This is my dependencies:
I carried out following actions:
Wifi connected
sim card, checked
push notification enabled.
API level fulfills the minimum required level.
But still does not work for the device. Is there any generous mind to help me with this? Spend almost two days, searched everywhere without vain and posted the question here.
Thanks
I faced problems like this sometimes (when push notification work on one device and doesn't work on other) and always the problem was in code.
1) If you are using gcm library try to check if your device register in gmc system, maybe problem is on this step.
2) I don't know how u testing push notifications (have u 2 physical devices or emulator), but u can try to clean project before build.
3) Also the problem can be on server side of ur app.
I have tested my code on Emulator as well as CM9 ROM. Everything works fine. But when I run my app on MIUI v3.6.28 Android Version 4.1.2 it doesn't trigger the SMS receiver.
I searched around on StackOverflow but couldnt find suitable answer except one mentioning about Phone manufacturers implementing internal classes themselves to avoid such behaviour. And MIUI being Xiami ROM maybe that is true. But then how would Go SMS and Handcent SMS work on these devices ?
http://miuiandroid.com/community/threads/sms-notification-not-working.16464/
This might solve the problem. I did not check it since I have moved to cm again for testing . but seems to solve exactly what I need. And description makes sense.
Miui takes preference and takes away the SMS before any other app can receive it.
In Xiaomi devices, you just have to add your app to Autostart list, to do so, follow these simple steps given below:
Open Security app on your phone.
Tap on Permissions, it'll show youtwo options: Autostart and Permissions.
Tap on Autostart, it'll show you list of apps with on or off toggle
buttons.
Turn on toggle of your app, you're done!
Note : When ran through your app via USB permissions is denied by
default for READ_SMS. You need to enable permission in Permission tab
of Security app for your app.
I am developing app on Android GCM push notification. Everything works fine .But I am not able to get the notification message when my device is on wifi rather than on data plan of service provider. In my case data plan is 3G but and notification comes as usual to devices but when device is connected through wifi I am not able to get any notifications.
Well this should not be the case, I have an android app that receives GCM push notifications regardless it is connected via 3G or Wi-Fi.
What I would suggest to troubleshoot this problem:
When you send the push notification from the server make sure to NOT include delay_while_idle, so the notification get delivered right away. Also make sure you have set time_to_live to a reasonable value (default is 4 weeks)
Try to hold a Wi-Fi lock in your app
Test with different device and/or Android version (maybe it is a problem with certain hardware/API version)