本文整理汇总了Java中com.digits.sdk.android.Digits类的典型用法代码示例。如果您正苦于以下问题:Java Digits类的具体用法?Java Digits怎么用?Java Digits使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Digits类属于com.digits.sdk.android包,在下文中一共展示了Digits类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.digits.sdk.android.Digits; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this,
new TwitterCore(
new TwitterAuthConfig(
getString(R.string.CONSUMER_KEY),
getString(R.string.CONSUMER_SECRET))),
new Digits.Builder().build());
Digits.authenticate(new AuthConfig.Builder().withAuthCallBack(new AuthCallback() {
@Override
public void success(DigitsSession session, String phoneNumber) {
Toast.makeText(TestDigitsActivity.this, "Digits sign in success " + phoneNumber,
Toast.LENGTH_LONG).show();
}
@Override
public void failure(DigitsException error) {
Toast.makeText(TestDigitsActivity.this, "Digits sign in failed ", Toast.LENGTH_LONG)
.show();
}
}).build());
}
开发者ID:firebase,项目名称:digits-migration-helper-android,代码行数:25,代码来源:TestDigitsActivity.java
示例2: login
import com.digits.sdk.android.Digits; //导入依赖的package包/类
private void login(final Application app) {
Log.v(LOG_TAG, "Create AuthCallback");
Builder configBuilder = null;
if (getCustomTheme().isEmpty()) {
Log.v(LOG_TAG, "Call Digits without a custom theme");
configBuilder = new DigitsAuthConfig.Builder()
.withAuthCallBack(authCallback);
} else {
Log.v(LOG_TAG, "Call Digits with the custom theme:'"
+ getCustomTheme() + "'");
configBuilder = new DigitsAuthConfig.Builder()
.withAuthCallBack(authCallback).withThemeResId(app.getResources().getIdentifier(getCustomTheme(),
"style", app.getPackageName()));
}
final Builder digitsAuthConfigBuilder = configBuilder;
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Digits.authenticate(digitsAuthConfigBuilder.build());
}
});
}
开发者ID:nifino,项目名称:twitter-digits-plugin,代码行数:27,代码来源:TwitterDigits.java
示例3: setUpSignOut
import com.digits.sdk.android.Digits; //导入依赖的package包/类
private void setUpSignOut() {
final TextView bt = (TextView) findViewById(R.id.deactivate_accounts);
bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Twitter.getSessionManager().clearActiveSession();
Digits.getSessionManager().clearActiveSession();
SessionRecorder.recordSessionInactive("About: accounts deactivated");
Answers.getInstance().logLogin(new LoginEvent().putMethod("Twitter").putSuccess(false));
Answers.getInstance().logLogin(new LoginEvent().putMethod("Digits").putSuccess(false));
Toast.makeText(getApplicationContext(), "All accounts are cleared",
Toast.LENGTH_SHORT).show();
}
});
}
开发者ID:crashlytics,项目名称:cannonball-android,代码行数:17,代码来源:AboutActivity.java
示例4: authenticate
import com.digits.sdk.android.Digits; //导入依赖的package包/类
public void authenticate() {
mCurrentAuthStatus = Auth_Status.AUTHENTICATE_ON_DIGIT;
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(getContext(), new TwitterCore(authConfig), new Digits.Builder().build());
AuthConfig.Builder mAuthConfig = new AuthConfig.Builder()
.withAuthCallBack(callback);
Digits.authenticate(mAuthConfig.build());
}
开发者ID:arunrajora,项目名称:Chit-Chat,代码行数:9,代码来源:LoginSplashFragment.java
示例5: onCreate
import com.digits.sdk.android.Digits; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.digits_activity_found_friends);
final FriendAdapter adapter = new FriendAdapter(this);
getListView().setAdapter(adapter);
final int MAX_BATCH_SIZE = 50;
Digits.getInstance().getContactsClient().lookupContactMatchesStart(new Callback<Contacts>() {
@Override
public void success(Result<Contacts> result) {
if (result.data.users != null) {
adapter.setNotifyOnChange(false);
for (DigitsUser user : result.data.users) {
adapter.add(user);
}
if(result.data.users.size() > 0){
adapter.notifyDataSetChanged();
}
}
// Make subsequent calls until all friend matches are retrieved
if (result.data.nextCursor != null) {
Digits.getInstance().getContactsClient()
.lookupContactMatches(result.data.nextCursor, MAX_BATCH_SIZE, this);
}
}
@Override
public void failure(TwitterException exception) {
Toast.makeText(FoundFriendsActivity.this, exception.getMessage(),
Toast.LENGTH_SHORT).show();
}
});
}
开发者ID:crashlytics,项目名称:digits-android,代码行数:36,代码来源:FoundFriendsActivity.java
示例6: onCreate
import com.digits.sdk.android.Digits; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
LeakCanary.install(this);
Log.d(TAG, "Setting up StrictMode policy checking.");
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
final TwitterAuthConfig authConfig = new TwitterAuthConfig(BuildConfig.CONSUMER_KEY,
BuildConfig.CONSUMER_SECRET);
final Digits digits = new Digits.Builder()
.withDigitsEventLogger(new CustomLogger())
.build();
final Fabric fabric = new Fabric.Builder(this)
.kits(digits, new Answers(), new TwitterCore(authConfig))
.logger(new DefaultLogger(Log.DEBUG))
.debuggable(true)
.build();
Fabric.with(fabric);
}
开发者ID:crashlytics,项目名称:digits-android,代码行数:32,代码来源:SampleApplication.java
示例7: RNDigits
import com.digits.sdk.android.Digits; //导入依赖的package包/类
public RNDigits(ReactApplicationContext reactContext) {
super(reactContext);
mContext = reactContext;
final TwitterAuthConfig authConfig = getTwitterConfig();
final Fabric fabric = new Fabric.Builder(mContext)
.kits(new Digits(), new TwitterCore(authConfig))
.logger(new DefaultLogger(Log.DEBUG))
.debuggable(true)
.build();
Fabric.with(fabric);
}
开发者ID:fixt,项目名称:react-native-digits,代码行数:15,代码来源:RNDigits.java
示例8: view
import com.digits.sdk.android.Digits; //导入依赖的package包/类
@ReactMethod
public void view(final Callback cb) {
authCallback = new AuthCallback() {
@Override
public void success(DigitsSession session, String phoneNumber){
WritableMap auth = Arguments.createMap();
Digits digits = Digits.getInstance();
TwitterAuthConfig config = digits.getAuthConfig();
auth.putString("consumerKey", config.getConsumerKey());
auth.putString("consumerSecret", config.getConsumerSecret());
TwitterAuthToken token = (TwitterAuthToken)session.getAuthToken();
auth.putString("authToken", token.token);
auth.putString("authTokenSecret", token.secret);
Long id = session.getId();
auth.putString("userId", String.valueOf(id));
auth.putString("phoneNumber", session.getPhoneNumber());
cb.invoke(null, auth);
}
@Override
public void failure(DigitsException error) {
cb.invoke(error.getLocalizedMessage(), null);
}
};
int themeId = mContext.getResources().getIdentifier("CustomDigitsTheme", "style", mContext.getPackageName());
DigitsAuthConfig.Builder digitsAuthConfigBuilder = new DigitsAuthConfig.Builder()
.withAuthCallBack(authCallback)
.withPhoneNumber("")
.withThemeResId(themeId);
Digits.authenticate(digitsAuthConfigBuilder.build());
}
开发者ID:fixt,项目名称:react-native-digits,代码行数:40,代码来源:RNDigits.java
示例9: initialize
import com.digits.sdk.android.Digits; //导入依赖的package包/类
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
authConfig = new TwitterAuthConfig(getTwitterKey(),
getTwitterSecret());
this.twitter = new TwitterCore(authConfig);
this.digits = new Digits();
Fabric.with(cordova.getActivity(), twitter, this.digits);
this.digits.getFabric().setCurrentActivity(cordova.getActivity());
Log.v(LOG_TAG, "Initialize TwitterDigits");
}
开发者ID:nifino,项目名称:twitter-digits-plugin,代码行数:14,代码来源:TwitterDigits.java
示例10: configureFabric
import com.digits.sdk.android.Digits; //导入依赖的package包/类
private void configureFabric() {
TwitterAuthConfig authConfig = new TwitterAuthConfig(getString(R.string.twitter_key), getString(R.string.twitter_secret));
final Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics(), new TwitterCore(authConfig), new Digits())
.debuggable(Config.DEBUG)
.build();
Fabric.with(fabric);
digitsAuthCallback = new AuthCallback() {
@Override
public void success(DigitsSession digitsSession, String phoneNumber) {
/*
session.getPhoneNumber(); OR, phoneNumber
TwitterAuthToken authToken = (TwitterAuthToken) session.getAuthToken();
String token = authToken.token;
String secret = authToken.secret;
session.getId();
*/
}
@Override
public void failure(DigitsException e) {
//
}
};
}
开发者ID:tausiq,项目名称:DroidPlate,代码行数:28,代码来源:CoreApplication.java
示例11: onCreate
import com.digits.sdk.android.Digits; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Session activeSession = SessionRecorder.recordInitialSessionState(
Twitter.getSessionManager().getActiveSession(),
Digits.getSessionManager().getActiveSession()
);
if (activeSession != null) {
startThemeActivity();
} else {
startLoginActivity();
}
}
开发者ID:crashlytics,项目名称:cannonball-android,代码行数:16,代码来源:InitialActivity.java
示例12: onCreate
import com.digits.sdk.android.Digits; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
singleton = this;
extractAvenir();
authConfig
= new TwitterAuthConfig(BuildConfig.CONSUMER_KEY, BuildConfig.CONSUMER_SECRET);
Fabric.with(this, new Crashlytics(), new Digits(), new Twitter(authConfig), new MoPub());
Crashlytics.setBool(CRASHLYTICS_KEY_CRASHES, areCrashesEnabled());
}
开发者ID:crashlytics,项目名称:cannonball-android,代码行数:12,代码来源:App.java
示例13: onCreate
import com.digits.sdk.android.Digits; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Runtime permission for read user contacts
checkForPermission();
setContentView(R.layout.activity_main);
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new TwitterCore(authConfig), new Digits.Builder().build());
// Clear previous layout themes
Digits.clearActiveSession();
Digits.Builder digitsBuilder = new Digits.Builder();
Fabric.with(this, new TwitterCore(authConfig), digitsBuilder.build());
DigitsAuthButton digitsButton = (DigitsAuthButton) findViewById(R.id.auth_button);
digitsButton.setAuthTheme(R.style.CustomDigitsTheme);
find_friends = (Button) findViewById(R.id.dgts__find_your_friends);
find_friends.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, FindFreinds.class);
startActivity(intent);
}
});
digitsButton.setCallback(new AuthCallback() {
@Override
public void success(DigitsSession session, String phoneNumber) {
// TODO: associate the session userID with your user model
Toast.makeText(getApplicationContext(), "Authentication successful for "
+ phoneNumber, Toast.LENGTH_LONG).show();
}
@Override
public void failure(DigitsException exception) {
Log.d("Digits", "Sign in with Digits failure", exception);
}
});
}
开发者ID:Fenscode,项目名称:twitter_digits_auth,代码行数:45,代码来源:MainActivity.java
示例14: onStop
import com.digits.sdk.android.Digits; //导入依赖的package包/类
@Override
protected void onStop() {
Digits.getInstance().removeSessionListener(sessionListener);
super.onStop();
}
开发者ID:crashlytics,项目名称:digits-android,代码行数:6,代码来源:DigitsMainActivity.java
示例15: logout
import com.digits.sdk.android.Digits; //导入依赖的package包/类
@ReactMethod
public void logout() {
Digits.getSessionManager().clearActiveSession();
}
开发者ID:fixt,项目名称:react-native-digits,代码行数:5,代码来源:RNDigits.java
注:本文中的com.digits.sdk.android.Digits类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论