Authorization
Configure
Device token
To enable/disable device token please add in yours AndroidManifest.xml next meta-data
<meta-data
android:name="com.platform101xp.sdk_huawei.device_token_enabled"
android:value="@bool/device_token_enabled" />
Setting up authorization providers
To enable/disable huawei authorization button in authorize dialog add in yours AndroidManifest.xml next meta-data:
<meta-data
android:name="com.platform101xp.sdk_huawei.enable_huawei_authorize"
android:value="@bool/huawei_authorize_enabled" />
Usage
Activity
In your MainActivity, you need to create the SDK instance and set the authorization listener:
public class MainActivity extends Activity {
private Platform101XPHuaweiAuthorizeListener authorizeListener;
private Platform101XPHuawei platformInstance;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
authorizeListener = (token, error) -> {
if (token != null) {
// Success Handler
} else if (error != null) {
// Error Handler
} else {
//Unknown error Handler
}
};
platformInstance = new Platform101XPHuawei
.Builder(this)
.setAuthorizeListener(authorizeListener)
.build();
}
}
After that, call the method authorize() to authorization. A result is passed to the listener (from the previous step):
platformInstance.authorize();
Please call the methos showProfile() to show profile dialog:
platformInstance.showProfile();