This NME native extension allows you to integrate Twitter into your NME application.
This is fully made with haxe code. The only native parts are the logins methods.
It support:
- iOS : Reverse Auth
- Android : Web Auth
- CPP : PIN Auth
There is an include.nmml file and ndll are compiled for:
- ios armv6
- ios armv7
- ios simulator
- android armv6
It should be soon on haxelib.
For android you need to merge you MainActivity.java if you are using another extension who is customizing the MainActivity ( by exammple HypFacebook )
If you need to use HypTwitter only just add in your nmml project file : template path="[bin-folder]/android/bin/MainActivityTwitter.java" rename="src/fr/hyperfiction/test/MainActivity.java"/>
For recompiling the native extensions just use the sh files contained in the project folder
Initiliazing :
var t = new HypTwitter( );
t.consumerKey= "xxxxxx";
t.consumerSecret= "xxxxx";
For developement mode you can defined your token & secret key:
t.token = ""; //Optional Developer token
t.tokenSecret = "";//Optional for developer
Login:
var connector = t.connect( _onConnect , _onError , _onAskPin );
For iOS & Android all is native & done automatically.
For c++ & other PIN base authorization targets when the "_askPin" method is called you must call the method verifiy with the user pin:
t.verifiy( "123456")
Then just do the request by using the call method of the HypTwitter class instance and use the TwitterRequest enum values :
Simple GET request:
_oTwitter.call( REQUEST( GET , HypTwitter.TIMELINE_USER ) );
Post a new Tweet:
_oTwitter.call( REQUEST(
POST ,
HypTwitter.TWEET_UPDATE ,
null ,
new Params( "status",">>Hello World Twitter from #Haxe &éè_çà)")
)
);
Better authentification for iOS & multiples accounts support. Adding all the requests in to the definitions. Better error handling.
hyperfiction.fr Developed by : Johann Martinache @shoe_box
This work is under BSD simplified License.