Emanuele Mazzante

Ranch Hand
+ Follow
since Jan 14, 2014
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Emanuele Mazzante

Also I think it's something specific about this particular device. I tried to disable any settings related to battery optimization but it doesn't seem to solve anything.

Thanks anyway for the time you have dedicated to me
3 years ago
No exception is thrown. The foreground service is always active (the icon is displayed) but the lister or receiver stops to work after one minute or two since the activity leaves the foreground. That's all.
3 years ago

Al Hobbs wrote:How are you running the app? Did you build an app file and install it that way?



I used all the methods I know:

  • Debug App and Run App commands from Android Studio
  • install / installDebug from Gradle Tasks in Android Studio
  • build / assemble or assembleDebug from Gradle Tasks in Android Studio and after I installed the apk in the device

  • 3 years ago

    Al Hobbs wrote:Hmm it doesn't make sense that it doesn't work on Oreo as that is newer.  Have you tried debugging it on your computer?



    Of course, I tried to debug but if the device is connected to the PC the app works well and I do not notice anything strange.

    I also tried to send the command in order to simulate the device not charging while connected via ADB in case there was some battery  optimization by the manufacturer, but everything works as it should when connected.

    I have also added methods to log to external memory file in order to monitor method calls when the device is not connected. However, I only verified that the onCallStateChanged method (or the onReceive method if I use a broadcast receiver) is not triggered when it should.
    3 years ago

    Al Hobbs wrote:So the problem is only on one of your phones?  If so it must be a comparability issue.



    That's how it seems. But I have only a few physical devices to test the app and only one with Android Oreo so I'm not sure about it.
    3 years ago
    Sorry for my english and thanks again for your help. However, if I disconnect the device while the app is running, nothing changes, the app works properly as long as it is in the foreground. If I press the home or back button (the activity leaves the foreground), the listener stops working correctly after one minute or two.

    This behavior only happens on my personal device with Android Oreo. I'm aware of the limitations on broadcasts and background services in Android 8 but I used a foreground service and the receiver is registered at runtime inside that service.

    I also used Gradle to install a debug release but nothing changed.

    Honestly, I'm starting to believe it's a problem related to the manufacturer update. Unfortunately I don't have another physical device with Oreo.
    3 years ago
    Thanks for your interest. The code works well on the emulator, it works well on Marshmallow and Nougat physical devices in any situation (regardless if they are connected to the PC or if the activity is in bacground or in the foreground).

    Instead when I test it on my personal device (Huawei / Honor 7x upgraded to Android Oreo) only works if connected to the PC. If disconnected, it stops working after a couple of minutes since the activity leaves the foreground.

    I also created a small example on Github where I replaced the phone listener with a broadcast receiver registered inside the service but nothing has changed.

    Thank for the help.
    3 years ago
    Hello everyone,
    I would like to create the classic Do Not Disturb App with the purpose of silencing notifications and ringtones at times specified by the user. The user could also choose a white list of contacts whose calls should not be silenced.

    I tried to create a foreground service in which to insert a phone state listener. Below is a test code. At the moment, when the service is active, the volume is raised for any incoming call. When the device stops ringing, the volume is lowered again.

    I tried the code in a physical device with Android 8. There are no problems when debugging with ADB connected. Instead, when I disconnect the device and try to call it, after some attempts the volume is no longer raised (even if the notification of the foreground service is always active).

    Manifest permissions:

    Starting the service from the Activity (after having requested the previous permissions at runtime):

    Service class:

    Utility methods to mute/unmute sounds:

    I also tried to add the request to put the app in the white list to ignore the battery optimizations (doze mode) but does not change anything.
    I did a lot of trials and changes but I just can not figure out where the problem is. The strange thing is that when I try to call the device (after a few minutes that has entered standby), the volume remains lowered but after hanging up, if I open the App, the volume is raised and immediately lowered. As if the turnVolumeOn / turnVolumeOff calls remained on a waiting list.

    I'm starting to think this app is above my ability. I really hope someone can help me understand. Thank you all for your attention
    3 years ago
    Thank you for your interest and help.

    May I ask why you consider the PHP-MYSQL option better than JAX-RS?

    I do not know either of them so I would like to understand the reasons for this choice.

    In your experience, could the learning curve of this option be steeper than learning JAX-RS?

    Thanks again for the help.
    3 years ago

    Richard Hayward wrote:

    There's a youtube playlist from javabrains Developing RESTful APIs with JAX-RS that I really liked:

    https://www.youtube.com/user/koushks

    I linked to this in a previous thread here, so apologies if you've already seen it.



    Thank you Richard you are very kind, I did not see it. Very helpful.
    3 years ago
    Thanks for your help. I will look for some material on JAX-RS.
    3 years ago

    Tim Moores wrote:For my apps I use JAX-RS web services running on Tomcat. Eventually it may be necessary to use a dedicated server I have for myself, but for the time being, a private Tomcat instance on a shared server works nicely.



    Thank you for your interest. Do you think JAX-RS can do for me? I had tried to look for some manual that started from the basics but I did not find much. Could you suggest me something to start with that is valid (video course, manual or other)?

    Thanks again
    3 years ago

    Norm Radder wrote:Can you define what you mean by "backend"?  What does the code do?  Where does it execute? Who would use it?



    Thank you for your interest and sorry if I have not been too clear.

    My idea of ​​backend is the following. When I think of an App to be implemented, I think of the features that allow me to save data in a cloud database so you can share it among different users of my app. Access to data would be through APIs that I would like to implement by myself.

    Therefore I would like to allow users of my app to access this data, clearly after authentication. I'd also like to send notifications. For example, if a user sends a specific request or data to the server, the server in turn should be able to send a notification to the users interested in that specific type of data.

    Perhaps the features listed so far are provided for example by Firebase (but I do not know it enough to say). However, a further use case would be to implement a logic in the server. For example, after a request has been submitted, the server should retrieve data from the database, perform processing, and return the result to one or more users.

    I hope I have been clear enough. Thank you again
    3 years ago
    Hello everyone,
    I've been following an online course on Android for about a year and I'd like to know how to get started to create a backend for my apps.
    I would like to learn how to create my own APIs that allow my Apps to perform server-side CRUD operations along with other logic to be implemented in the backend.

    My only server-side programming experience was gained through the book Murach's Java servlets and JSP but I think this does not help me for what I would like to do.

    Searching on the net, I see recommended PHP as well as Node.js or Google Cloud Engine to create a backend for Android app. Would anyone kindly spell out a few words to tell me how and where to start? I would be happy to receive a suggestion regarding a good manual to buy.

    Thank you all for your attention
    3 years ago
    Hi Pete,
    I'm very embarrassed to answer you. Only now I realize that, I do not know exactly why, the answer I had prepared was not successful. Surely for my carelessness.
    Anyway, please forgive me. Thank you for spending time helping me. I'm very grateful.
    All the best
    3 years ago