I am writing a multiplayer game and if I start the app from a desktop icon and another player takes a turn then the game updates correctly via the UpdateMatchResult callback. However, if I don't have the app open and get a notification that a turn has been taken by Google Play Games, then if I respond to that notification and use Google Play Games to take me to the match in my app, then if I take a turn and await an update after another player takes a turn, I continue to get notifications, even though I am actually in the app.
What could be causing this? Ideally, I'd like to see the update in the game, as I do when I go in via the normal icon.
This was a simple coding issue. I have solved this now.
Related
I have an app I have building that is giving navigation from a location to a location. Contstantly tracking where the user is using GPS data in order to give good Directional information. Currently if a user switches from our app to another app or goes to the Android home screen, after one minute Android turns off our app for performance reasons.
I have tried using an Isolate but like flutter this gets shutdown. Next step were to use a kotlin service to handle background things but i wanted to check if anyone had done this in dart yet?
Also this is not an app that will be in the play store or on public devices. It is going on special devices that we control and are less worried about memory usage as this will be the main app ran on them.
as mentioned above in the comment by #galloper background_fetch is the thing you need, it has a method called BackgroundFetch.registerHeadlessTask(backgroundFetchHeadlessTask); where backgroundFetchHeadlessTask is a function that will keep running even when the app is close, i used this in my app to stream location info to server.
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.
At least for iOS, apps like Spotify, Hangouts, and Google Maps have a way of showing that they're still active when in the background (when you temporarily leave them to check a different app, etc.). This typically appears as a thicker status bar in iOS.
Other variants:
What is this bar called, and is this possible to implement for Android? I have a video chat app (in both Google Play and App Store) that uses TokBox (essentially WebRTC), and it renders this bar already for iOS when backgrounded, but not Android.
The consistent way to indicate an ongoing phone call in Android is using a notification. The Android phone app also uses a notification in this scenario:
To prevent the user from dismissing this notification, you can use the FLAG_ONGOING_EVENT or FLAG_NO_CLEAR - see https://developer.android.com/reference/android/app/Notification#FLAG_ONGOING_EVENT
On iOS, you might want to set a specific Audio Mode and Audio Category to get the right status bar look.
See https://developer.apple.com/documentation/audiotoolbox/audio_session_services/1618405-audio_session_modes
and https://developer.apple.com/documentation/audiotoolbox/audio_session_services/1618427-audio_session_categories
Further, the Background Audio capability is required - otherwise, your Apps audio session will be stopped after moving it to the background.
To achieve an even more consistent user experience, you might want to integrate the iOS CallKit or the Android ConnectionService, see
- https://developer.apple.com/documentation/callkit
- https://developer.android.com/reference/android/telecom/ConnectionService
It can be implemented in Android by using a notification and adding a flag FLAG_NO_CLEAR
This is a link where this is explained pretty clearly
How do i make custom popup notifications for google glass the way it is shown in the google glass commercial. I want my service to run on the background and send timely popups only when necessary.
Link for reference
http://www.mobile88.com.sg/news/read.asp?file=/2012/5/11/20120511113022&phone=Google_Glass_augmented_reality__futuristic_concept
Is there a possible way to do so or should I just use only Toast notifications or invoke activities through intents.
The "popup" design from that conceptual video was tested by the Glass team before it was released to the public and found to be overly distracting. It evolved into the concept of timeline notifications which are not as invasive, but which still act as timely alerts only when appropriate.
These timeline notifications can generally be done in one of two ways, depending on your exact use case:
Your app or webapp can use the Mirror API to insert a timeline item at the appropriate time with a notification sound. Users will hear the sound and, if they are in a position to do so, can wake Glass to see the card.
Your GDK app can create a LiveCard and publish it with LiveCard.PublishMode.REVEAL which will automatically display the card right after you publish it.
I have an android app that is published in the Google Play Store. The Google Play Store app is how end-users install updates. I realize it's up to the user's discretion to turn on auto-updates, so this feature may or may not be turned on with any given phone.
My app runs a foreground service with an icon in the notification bar when it's running. During testing of the auto-update procedure, I noticed that if the service is running and the app updates itself, the service is shutdown (which is to be expected since new code is being installed).
However, I would like to avoid this if at all possible. What I would like to happen is find a way to detect when auto-update tries to update my app. If the service is running, I'd like to deny updates until the service finishes it's work and shuts down.
So is there any way to detect when the google play store attempts to update your app, and if so, is there a way to block the update until you determine your app is in a safe state to shutdown?
Unfortunately, I don't think there is a way to detect when the Play Store attempts to update your app, unless you have a second app to listen for this event. And even if you have a way to detect this, I don't think you can cancel the update.
Maybe it would be an idea for you to transfer the work you are doing to your second app while the first one is being updated. However, I needn't say that this sounds like a very hacky solution.
You should focus on saving your state and continuing from where you left after the application is updated and started.