update initialization flow
This commit is contained in:
Родитель
54569e3f28
Коммит
68adbf2079
|
@ -33,5 +33,5 @@ dependencies {
|
|||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||
compile('ms.loop:loopsdk:2.0.1-develop') { changing = true }
|
||||
compile('ms.loop:loopsdk:2.0.2') { changing = true }
|
||||
}
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="loop.ms.loophello">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
<!-- Not visible to Google App indexer -->
|
||||
<!--suppress GoogleAppIndexingWarning -->
|
||||
<application
|
||||
|
|
|
@ -8,6 +8,8 @@ import android.util.Log;
|
|||
|
||||
import ms.loop.loopsdk.core.ILoopSDKCallback;
|
||||
import ms.loop.loopsdk.core.LoopSDK;
|
||||
import ms.loop.loopsdk.providers.LoopLocationProvider;
|
||||
import ms.loop.loopsdk.signal.SignalConfig;
|
||||
import ms.loop.loopsdk.util.LoopError;
|
||||
|
||||
public class LoopHelloApplication extends Application implements ILoopSDKCallback {
|
||||
|
@ -23,11 +25,11 @@ public class LoopHelloApplication extends Application implements ILoopSDKCallbac
|
|||
editor.apply();
|
||||
|
||||
// initialize the Loop SDK. create an account to get your appId and appToken
|
||||
String appId = "YOUR_APP_ID";
|
||||
String appToken = "YOUR_APP_TOKEN";
|
||||
String appId = "test-project-dev-dce9076d";
|
||||
String appToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb3V0ZXMiOlt7Im1ldGhvZCI6InBvc3QiLCJwYXRoIjoiL3YyLjAvYXBwL3Rlc3QtcHJvamVjdC1kZXYtZGNlOTA3NmQvdXNlciJ9LHsibWV0aG9kIjoiZGVsZXRlIiwicGF0aCI6Ii92Mi4wL2FwcC90ZXN0LXByb2plY3QtZGV2LWRjZTkwNzZkL3VzZXIifSx7Im1ldGhvZCI6InBvc3QiLCJwYXRoIjoiL3YyLjAvYXBwL3Rlc3QtcHJvamVjdC1kZXYtZGNlOTA3NmQvbG9naW4ifSx7Im1ldGhvZCI6ImdldCIsInBhdGgiOiIvdjIuMC9hcHAvdGVzdC1wcm9qZWN0LWRldi1kY2U5MDc2ZC91c2VyIn0seyJtZXRob2QiOiJnZXQiLCJwYXRoIjoiL3YyLjAvYXBwL3Rlc3QtcHJvamVjdC1kZXYtZGNlOTA3NmQvdXNlci9bXi8uXSsifSx7Im1ldGhvZCI6InBvc3QiLCJwYXRoIjoiL3YyLjAvYXBwL3Rlc3QtcHJvamVjdC1kZXYtZGNlOTA3NmQvbWFuYWdlLy4qIn0seyJtZXRob2QiOiJnZXQiLCJwYXRoIjoiL3YyLjAvYXBwL3Rlc3QtcHJvamVjdC1kZXYtZGNlOTA3NmQvbWFuYWdlLy4qIn0seyJtZXRob2QiOiJkZWxldGUiLCJwYXRoIjoiL3YyLjAvYXBwL3Rlc3QtcHJvamVjdC1kZXYtZGNlOTA3NmQvbWFuYWdlLy4qIn1dLCJpc3MiOiJNaWNyb3NvZnQgTE9PUCBBdXRoIFYyIiwic3ViIjoidGVzdC1wcm9qZWN0LWRldi1kY2U5MDc2ZCJ9.gif-sN47PFaiNewOPsHCOr87bOsxNuXAU4KyDNqKgBs";
|
||||
|
||||
String userId = "YOUR_USER_ID";
|
||||
String deviceId = "YOUR_DEVICE_ID";
|
||||
String userId = "2d9aded5-60cd-4ac7-8648-b2da4babcfe1";
|
||||
String deviceId = "1752c39c-8db1-42aa-8490-5a65d93c902e";
|
||||
|
||||
LoopSDK.initialize(this, appId, appToken, userId, deviceId);
|
||||
}
|
||||
|
@ -37,6 +39,8 @@ public class LoopHelloApplication extends Application implements ILoopSDKCallbac
|
|||
public void onInitialized() {
|
||||
Log.d("loop_sdk", "Successfully Initialized");
|
||||
|
||||
LoopLocationProvider.start(SignalConfig.SIGNAL_SEND_MODE_BATCH);
|
||||
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(LOOP_SDK_STATE, "initialized");
|
||||
|
|
|
@ -51,7 +51,7 @@ public class MainActivity extends AppCompatActivity implements SharedPreferences
|
|||
testCompletedView.setVisibility(View.INVISIBLE);
|
||||
testCompletedView.setTextColor(Color.green(Color.GREEN));
|
||||
|
||||
LoopSDK.sendTestSignal(new ILoopServiceCallback<Integer>() {
|
||||
LoopSDK.sendTestLocationSignal(new ILoopServiceCallback<Integer>() {
|
||||
@Override
|
||||
public void onSuccess(Integer signalsUploaded) {
|
||||
Log.d(TAG, "sendTestSignal success statusCode: 201");
|
||||
|
|
Загрузка…
Ссылка в новой задаче