Nativescript Twitter
NativeScript implementation of Twitter SDK (Some Features)
NS 3.0+
tns plugin add nativescript-twitter
NS < 3.0
npm install nativescript-twitter@"^1.x"
Example Implementation
Android
//app.ts or main.ts;if app.android
IOS
Note
Twitter Kit looks for a URL scheme in the format twitterkit-<consumerKey>,
where consumerKey is your application’s Twitter API key, e.g. twitterkit-dwLf79lNQfsJ.
In your app’s Info.plist, add URL Schemes by adding code below after <dict>
Source
// Info.plist <key>CFBundleURLTypes</key><array> <dict> <key>CFBundleURLSchemes</key> <array> <string>twitterkit-<consumerKey></string> </array> </dict></array><key>LSApplicationQueriesSchemes</key><array> <string>twitter</string> <string>twitterauth</string></array
//custom-app-delegate.ts;declare ;
//app.ts or main.ts;if app.ios
IMPORTANT: Make sure you include xmlns:twitter="nativescript-twitter" on the Page tag
Listen when user auth is successful or fails
; frame.topmost.getViewById'twitter'.on'loginStatus',;
Send api request
; api.makeRequest"https://api.twitter.com/1.1/account/verify_credentials.json", "get" .then , ;
Angular
;registerElement"TNSTwitterButton",require"nativescript-twitter".TNSTwitterButton;