Build google api client:
m_googleApiClient = builder.
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
The location request looks like this:
<receiver android:name="com.sessionm.api.ConnectionReceiver" > | |
<intent-filter> | |
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" > | |
</action> | |
</intent-filter> | |
</receiver> | |
<activity | |
android:name="com.sessionm.ui.SessionMActivity" | |
android:configChanges="keyboard|orientation|screenSize" | |
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" |
package test.com.sessionm.app; | |
import android.app.Activity; | |
import android.app.AlertDialog; | |
import android.content.DialogInterface; | |
import android.util.Log; | |
import com.sessionm.api.AchievementData; | |
import com.sessionm.api.AchievementActivity; | |
import com.sessionm.api.AchievementActivityIllegalStateException; | |
import com.sessionm.api.SessionM; |
// | |
// ExampleAppDelegate.m | |
// MyApp | |
// | |
// | |
#import "ExampleAppDelegate.h" | |
#import "SessionM.h" | |
@implementation ExampleAppDelegate |
Build google api client:
m_googleApiClient = builder.
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
The location request looks like this:
let path : URL = Bundle.main.path(forResource: "scifi-novels", ofType: "json").flatMap { | |
URL.init(fileURLWithPath: $0) | |
}! | |
let data = try! Data(contentsOf: path) | |
let json = try! JSONSerialization.jsonObject(with: data) as? [String: Any] |
create(image: image) { [weak self] key, error in | |
guard let `self` = self else { | |
return | |
} | |
if let error = error { | |
self.completion?(nil, error) | |
self.completion = nil | |
return | |
} |
let cachingGitHub = CachingGitHub() | |
struct GitHub { | |
var latestRepos: () -> [Repo] = { return cachingGitHub.latestRepos } | |
var fetchRepos: (@escaping (Result<[Repo], APIError>) -> Void) -> Void = cachingGitHub.fetchRepos | |
} | |
class CachingGitHub { | |
var latestRepos = [Repo]() | |
func fetchRepos(completion: @escaping (Result<[Repo], APIError>) -> Void) { |
I hereby claim:
To claim this, I am signing this object: