Comments (4)
Actually, it looks like onActivityResult is passed to fragments (who knew?) so your base activity could actually be very little.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHelper = GameHelper.attach(this, <optional flags for clients here>);
}
// methods that wrap mHelper in a warm, loving embrace.
from android-basic-samples.
Good idea. We'll look into it.
from android-basic-samples.
Hi @chrisrhoden
This is real cool idea, I have tried it, and it works well. But I can not omit calling mHelper.onActvityResult() in my container activity. Can you show me what you did, so you can omit calling helper's onActivityResult() explicitly in container activity?
What I did is: (similar to your first comment)
In container activity:
@override
public void onCreate(Bundle savedInstanceState) {
...
mHelper = (ApiHelper) getSupportFragmentManager().findFragmentByTag(TAG_API_HELPER);
if (mHelper == null) {
Bundle args = new Bundle();
args.putInt(RC_RESOLVE_SIGNIN, 9999); /* tell helper to use which request code number to resolve sign in error */
args.putXXX(...) /* any other thing, ex: flag for different clients */
mHelper = (ApiHelper) Fragment.instantiate(this, ApiHelper.class.getName(), args);
getSupportFragmentManager().beginTransaction().add(mHelper, TAG_API_HELPER).commit();
}
}
@override
public void onActivityResult(int request, int result, Intent data) {
super.onActiivtyResult(request, result, data);
if (request == 9999)
mHelper.onActvityResult(request, result, data);
}
In helper
@override
public void onConnectionFailed(ConnectResult result) {
...
if (result.hasResolution()) {
Bundle args = this.getArguments();
int rc = args.getInt(RC_RESOLVE_SIGNIN);
result.startResolutionForResult(getActivity(), rc); /* The first parameter needs activity, I can not use fragment here. So, I think currently the resolution activity is started from container activity instead of fragment itself */
}
}
from android-basic-samples.
Closing due to the samples no longer using BaseGameActivity/GameHelper. See this video for more information.
from android-basic-samples.
Related Issues (20)
- r
- Somehow able to download removed games on the google play store using google play games.
- Popup achievements not working HOT 1
- There's a bug with just dance now
- Hai team there is a bug in one of your instant snake game
- Google Play screen keeps loading (spinning circle) after adding auth scopes
- Cannot use snapshots without enabling the 'Saved Game' feature in the Play console HOT 2
- Drive.SCOPE_APPFOLDER deprecated!!! HOT 2
- 100% "google.play.games.games.v1.Applications.RecordApplicationActivity" since one Month HOT 1
- GamesClientStatusCodes.SNAPSHOT_CONTENTS_UNAVAILABLE status code returned when opening save backing HOT 15
- Issues with the Saved Games API HOT 11
- GPS v21.0.0 = cannot find symbol method `getSnapshotFromBundle(Bundle)`
- Snapshot API - High error rate in Google Cloud Platform console
- jbeubfjbuwe
- play-services-games:22.0.0 - Random (Rare) Freeze "com.google.android.gms is currently frozen" HOT 2
- Override onShowLeaderboardsRequested
- getLeaderboardsClient method is not in Games anymore
- Service
- Outdated sample projects. Update to GPGS v2.
- no change packeg name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-basic-samples.